Joyride is en extension that lets you script VS Code like Emacs users script Emacs. Like with Emacs the scripting language is a LISP, making the programming fully interactive. The language is not ELisp, though. Instead something much nicer: Clojure. Or, something more familiar to some of you: JavaScript.
^ Demo using this starter template ^
In the demo I use Clojure for solving Day 1. But you can use JavaScript if you like. Take a look at .joyride/scripts/aoc2022_1_js.cljs and .joyride/src/aoc/day-1.jswhich form a scaffold for how to do this.
This is a template repository to make it quick and easy to get started using VS Code and Clojure to solve Advent of Code problems.
- A scaffold script for solving the two parts of Day 1:
- A utility namespace for loading your AOC problem input for any (released) day
- Instructions to guide you
- Curiosity
- VS Code, with enough knowledge of how to use it, find commands and such
- A copy of this repository opened in VS Code
Two VS Code extensions:
- Joyride - The scripting environment, which includes Clojure and an nREPL server
- Calva - A Clojure IDE, which includes an nREPL client
Don't worry if you don't have a clue what nREPL is, I won't even link to it here. What ”you will have both a server and a client” means for you is that you don't need anything else to program in Clojure.
To use the utility for downloading your AOC problems input, you will need to login to your AOC account and make that session available to the Joyride scripts. The utility script assumes a file named .aoc-session
in the workspace root. This file should contain only the contents of the session
cookie from the browser's session. A way to get at this cookie is:
- Open the browser development console when you are logged in at https://adventofcode.com
- Open the Networks tab
- Reload the page
- Click the resource you have reloaded, (
1
if it was the Day 1 problem page) - Look for the cookies in the request headers.
- Copy the content (right click -> copy)
- Paste the contents into the file
.aoc-session
In VS Code that is.
Depending on if you are going to solve the puzzle in Clojure or JavaScript
- Clojure:
- JavaScript:
Then follow the instructions in the files.
See this presentation with demo about what Joyride is and can do:
- Examples from that demo, with instructions: https://github.com/PEZ/london-clojurians-joyride
- Demo: https://www.youtube.com/watch?v=ObjIR08t3lg
- Joyride repository: https://github.com/BetterThanTomorrow/joyride
All content in this repository is free to use as you see fit. At your own risk.
Please join the #joyride
channel on Clojurians Slack to get help, provide feedback, and share your solutions. You can also reach us in the Discussions section of the Joyride repository.