James Thatcher's solutions for Advent Of Code 2021 in PHP 8.1

Overview

Advent of Code 2021 PHP

The solutions to advent of code 2021, solved using PHP 8.1. By James Thatcher

Solutions ๐Ÿฅณ ๐ŸŽ‰

๐ŸŽ„ Day 1 ๐ŸŽ… Day 2 โ˜ƒ๏ธ Day 3 ๐ŸฆŒ Day 4 ๐Ÿช Day 5 ๐Ÿฅ› Day 6 ๐Ÿงฆ Day 7 ๐ŸŽ Day 8

About

My attempts at tacking the awesome challenges at Advent of Code 2021 using PHP 8.1.

Unlike my solutions for AOC 2020, where I used array_* functions and aimed for maximum efficiency, this year I'm using the excellent Collections package that comes with Laravel. This lets me do common array manipulation without effort, and not losing much in the way of performance. Although as you'll see, I still love a good recursive function ๐Ÿ˜‰

day runner in action

Commands

Note: checkout the code then run make run. The docker and composer libraries will auto install.

Solve all days puzzles
make run

Solve an individual days puzzles
make run day={N} e.g. make run day=13

Solve a single part of a days puzzles
make run day={N} part={N} e.g. make run day=16 part=2

Create the next days PHP files
Auto detects what current Day you are on and will create the next (only if the files don't exist)

make new
# Created new file: src/Day8.php

Fetch the next days input from the server.

make get-input
# Fetching latest input using day=8 AOC_COOKIE=53616c7465645f5f539435aCL1P
./input/day8.txt downloaded

Note: The Makefile reads the /src directory to find the most recent DayN.php file. If you had just completed Day1.php you would create a Day2.php (by running make new) and then run this command to fetch /input/day2.txt

Use XDebug
make xdebug

Xdebug can also be triggered on a single days and/or part
make xdebug day={N} e.g. make xdebug day=13 or make xdebug day=13 part=2

IDE settings:

  • 10000 - xdebug port
  • aoc-2021 - PHP_IDE_CONFIG (what you put in PHPStorm -> settings -> debug -> server -> name)
  • /app - absolute path on the server
  • see xdebug.ini if you're stuck
You might also like...
Tcc realizado na Etec de Guaianazes (2021),onde eu fui o back-end e Vinicius de Almeida foi o front-end.

TCC-Facilita+ Todos os arquivos do projeto de TCC (Facilita+) da Etec de Guaianases realizado em 2021 1ยฐ Para utilizar os arquivos,primeiro serรก nesce

Log4j RCE - (CVE-2021-44228)
Log4j RCE - (CVE-2021-44228)

Log4j-RCE Log4j RCE - (CVE-2021-44228) How To Run? php log4j.php https://1337.com Requirements PHP CURL PAYLOAD DNS LOG (Collaborator Burpsuite or use

cve-2021-38314 - Unauthenticated Sensitive Information Disclosure
cve-2021-38314 - Unauthenticated Sensitive Information Disclosure

cve-2021-38314 - Unauthenticated Sensitive Information Disclosure The Gutenberg Template Library & Redux Framework plugin = 4.2.11 for WordPress regi

Result of our code-along meetup writing PHP 8.1 code

PHP 8.1 Demo Code This code demonstrates various PHP 8.0 and 8.1 features in a realistic, functional (but incomplete) codebase. The code is part of so

Dead Code Detector (DCD) for PHP code.

This project is no longer maintained and its repository is only kept for archival purposes. PHP Dead Code Detector (PHPDCD) phpdcd is a Dead Code Dete

โš—๏ธ Adds code analysis to Laravel improving developer productivity and code quality.
โš—๏ธ Adds code analysis to Laravel improving developer productivity and code quality.

โš—๏ธ About Larastan Larastan was created by Can Vural and Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural, Nuno Maduro, and Vik

Free ZIP Code API - Free Access to Worldwide Postal Code Data

About Zipcodebase - Free Zip Code API Zipcodebase is a zip code API that was founded in 2019 to solve common issues with postal code data. As we have

Preload your sweet sweet code to opcache with a composer command, making your code faster to run.

Composer Preload Preload your sweet sweet code to opcache with a composer command, making your code run faster. Composer Preload is a composer plugin

The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces

SensioLabs DeprecationDetector CAUTION: This package is abandoned and will no longer receive any updates. The SensioLabs DeprecationDetector runs a st

Owner
James Thatcher
James Thatcher
YCOM Impersonate. Login as selected YCOM user ๐Ÿง™โ€โ™‚๏ธin frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
Public solutions and challenges from sinf ctf 2021

SINFCTF2021 CTF Challenges (and official solutions) created for SINFCTF2021, a companion CTF for Semana de Informรกtica 2021. There's a folder for each

NIAEFEUP 5 Sep 30, 2022
Messaging solutions for PHP - It contains advanced features build on top of a transport component

It contains advanced features build on top of a transport component. Client component kind of plug and play things or consumption component that simplify message processing a lot. Read more about it in documentation.

Enqueue 175 Jan 3, 2023
Developer-friendly framework heavily inspired by Laravel and based on Timber and Wpemerge solutions for WordPress themes development with Bedrock folder structure

Lightweight Brocooly (Brocket) Improved Controllers, Middleware and Routers, but slightly less powerful Container Open beta. Package in development Cr

Ihar Aliakseyenka 3 Mar 4, 2022
Code de la nuit de l'info 2021

NuitDeInfo2021 โš ๏ธ Warning: Be very careful here! documetation utilisation git soit par terminal ou dans un IDE (Atom, PhpStorm) ou GitHub Desktop Star

null 0 Sep 20, 2022
Repository untuk kuliah rekayasa web ss 2021

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Sandhika Galih 7 Jul 11, 2022
ShellHacks 2021 Project: URide is a carpooling app for College students to get to and from campus

ShellHacks 2021 Project: URide is a carpooling app for College students to get to and from campus. Focused on scheduling it matches you to students nearby with similar schedules to alleviate campus parking and emissions.

Kayla Marcantonio 2 Sep 27, 2021
The slides and demo files for my Alpine Day 2021 talk

Building a Better Dialog Austen Cameron - @austencam This repository contains the slides and demos for my talk from Alpine Day 2021. Below, you'll fin

Austen Cameron 9 Nov 16, 2021
Repo pour la Nuit de l'Info 2021, รฉquipe Passage Python

Passage Python Repo pour la Nuit de l'Info 2021, รฉquipe Passage Python Les membres de l'รฉquipe sont : Florian Duzes, FloDarPie Theo Cavailles, igneefl

Florian Duzes 3 Dec 3, 2021
Docker images for Cyber_Security hakathon 2021.

This repository contains a set of vulnerable Docker images for attacking the container environment compiled for Cyber_Security hackathon 2021. Require

null 1 Dec 1, 2022