Setting up CodeSandbox for Advent of Code 2021 — Part 1

Setting up an environment for coding is not hard. I can just open a workspace in VS Code, and pull some template on GitHub. However, I want something that can be accessed from the cloud and hot-reload automatically just by specifying Day X Problem Y instead of typing the commands in the terminal to run a specific problem. See example below:

Phuoc Do
1 min readDec 3, 2021

In this setup

  • Chose CodeSandbox as a cloud environment as it’s easy to setup and can be accessed anywhere on any device.
  • Built a CLI that asks for the puzzle to run (in form of X-Y short for Day X problem Y), and then re-ask for another puzzle after finishing execution of the current one.
  • Built a good folder structure that can be generalized for every puzzle: input.txt, parser.ts, and solver.ts

Fork this and check it yourself

  • Step 1: Click “Open Sandbox” in the window below
  • Step 2: Fork it! (“Fork” button on top right corner of the screen)
  • Step 3: Follow example puzzles for Day 1 and Day 2 of AoC 2021 which have been provided in the template.

Happy Coding!

--

--

Phuoc Do
Phuoc Do

Written by Phuoc Do

Software Engineer @ Meta — Building tools to optimize productivity

No responses yet