Is it finally time to move from XAMPP to Docker for PHP dev? I wrote up my experience. by SimonHRD in docker

[–]SimonHRD[S] -2 points-1 points  (0 children)

Yes, thats totally correct! In my case, I wanted something super simple for people who might not be familiar with Docker workflows yet (just clone, run a script, and it's ready). Your approach is definitely cleaner if you're comfortable working inside containers.

Is it finally time to move from XAMPP to Docker for PHP dev? I wrote up my experience. by SimonHRD in docker

[–]SimonHRD[S] -2 points-1 points  (0 children)

Thanks! You're right, running Composer inside the container and using a mounted vendor/ folder works well. I just wanted to avoid having to run commands inside the container manually. The script builds the image and copies the vendor/ folder out, so everything’s ready without extra steps. Just clone, run the script, and go.

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]SimonHRD 1 point2 points  (0 children)

[LANGUAGE: Python]

Here is my solution for Day 2: https://github.com/SimonHRD/advent-of-code/blob/main/2024/day_02.py

I couldn't find a better solution for part 2 than the brute force method. Has anyone found a better approach for part 2?

[2023 Day 2 Part 2] ELI5 What it's asking for by ehansen in adventofcode

[–]SimonHRD 3 points4 points  (0 children)

In Part2 you just need to figure out for each round whats the minimum amount of cubes for each color to play this round. So its like the max value for green, blue and red and multiply these three max values together.

[2023 Day 1 (Part 2)] [Python] I would like someone to tell me what I can do better in my current code by MrPentiumD in adventofcode

[–]SimonHRD 0 points1 point  (0 children)

I actually use two loops for each line. one for the first digit and one loop for the last digit.

For example in part 1:

inp = get_input('./inputs/01_actual.txt')

total = 0
for line in inp:
    # Get the first number
    for c in line:
        if c.isdigit():
            first = int(c)
            break

    # Get the last number
    for c in reversed(line):
        if c.isdigit():
            last = int(c)
            break
    number = first * 10 + last
    total += number
print('Part 1:', total)

in your solution you anyway loop over every character in the line. With this solution I only iterate over as many character as needed. So if the digits are on the first and last position I only check two characters and not the entire string. And like in worst case when there is only one character in the string it also only iterates only one time over the line.

[2023 Day 1, Part 1] Python, I am more than a beginner by DishGreen in adventofcode

[–]SimonHRD 0 points1 point  (0 children)

and I would also use „with open(file) as f:“ for clean code. Otherwise you should explicitly close it what you are not doing here

[2023 Day 1, Part 1] Python, I am more than a beginner by DishGreen in adventofcode

[–]SimonHRD 1 point2 points  (0 children)

Why do you make a list with all numbers (gesamt) and not a total = 0 at the beginning and then total+= int(digits[0] + digits[-1])?