• Stars
    star
    125
  • Rank 276,081 (Top 6 %)
  • Language
    Elixir
  • Created over 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Template project for Advent of Code in Elixir.

Advent of Code Elixir Starter

A batteries included starter pack for participating in Advent of Code using Elixir!

Usage

There are 25 modules, 25 tests, and 50 mix tasks.

  1. Fill in the tests with the example solutions.
  2. Write your implementation.
  3. Fill in the final problem inputs into the mix task and run mix d01.p1!
    • Benchmark your solution by passing the -b flag, mix d01.p1 -b
defmodule AdventOfCode.Day01 do
  def part1(args) do
  end

  def part2(args) do
  end
end
defmodule AdventOfCode.Day01Test do
  use ExUnit.Case

  import AdventOfCode.Day01

  @tag :skip # Make sure to remove to run your test.
  test "part1" do
    input = nil
    result = part1(input)

    assert result
  end

  @tag :skip # Make sure to remove to run your test.
  test "part2" do
    input = nil
    result = part2(input)

    assert result
  end
end
defmodule Mix.Tasks.D01.P1 do
  use Mix.Task

  import AdventOfCode.Day01

  @shortdoc "Day 01 Part 1"
  def run(args) do
    input = AdventOfCode.Input.get!(1, 2020)

    if Enum.member?(args, "-b"),
      do: Benchee.run(%{part_1: fn -> input |> part1() end}),
      else:
        input
        |> part1()
        |> IO.inspect(label: "Part 1 Results")
  end
end

Optional Automatic Input Retriever

This starter comes with a module that will automatically get your inputs so you don't have to mess with copy/pasting. Don't worry, it automatically caches your inputs to your machine so you don't have to worry about slamming the Advent of Code server. You will need to configure it with your cookie and make sure to enable it. You can do this by creating a config/secrets.exs file containing the following:

import Config

config :advent_of_code, AdventOfCode.Input,
  allow_network?: true,
  session_cookie: "..." # yours will be longer

After which, you can retrieve your inputs using the module:

day = 1
year = 2020
AdventOfCode.Input.get!(day, year)
# or just have it auto-detect the current year
AdventOfCode.Input.get!(7)
# and if your input somehow gets mangled and you need a fresh one:
AdventOfCode.Input.delete!(7, 2019)
# and the next time you `get!` it will download a fresh one -- use this sparingly!

Installation

# clone
$ git clone [email protected]:mhanberg/advent-of-code-elixir-starter.git advent-of-code
$ cd advent-of-code

# Reinitialize your git repo
$ rm -rf .git && rm -rf .github
$ git init

Get started coding with zero configuration

Using Visual Studio Code

  1. Install Docker Desktop
  2. Open project directory in VS Code
  3. Press F1, and select Remote-Containers: Reopen in Container...
  4. Wait a few minutes as it pulls image down and builds Dev Conatiner Docker image (this should only need to happen once unless you modify the Dockerfile)
    1. You can see progress of the build by clicking Starting Dev Container (show log): Building image that appears in bottom right corner
    2. During the build process it will also automatically run mix deps.get
  5. Once complete VS Code will connect your running Dev Container and will feel like your doing local development
  6. If you would like to use a specific version of Elixir change the VARIANT version in .devcontainer/devcontainer.json
  7. If you would like more information about VS Code Dev Containers check out the dev container documentation

Compatible with Github Codespaces

  1. If you dont have Github Codespaces beta access, sign up for the beta https://github.com/features/codespaces/signup
  2. On GitHub, navigate to the main page of the repository.
  3. Under the repository name, use the Code drop-down menu, and select Open with Codespaces.
  4. If you already have a codespace for the branch, click New codespace.

More Repositories

1

temple

An HTML DSL for Elixir and Phoenix
Elixir
416
star
2

elixir.nvim

Neovim plugin for Elixir
Lua
157
star
3

jekyll-tailwind-starter

Starter project for using Jekyll with Tailwind CSS
CSS
108
star
4

lazyasdf

Experimental TUI for asdf: a project to learn the art of the TUI.
Elixir
101
star
5

output-panel.nvim

A panel to view the logs from your LSP servers.
Lua
61
star
6

jekyll-postcss

A plugin to use PostCSS plugins like Autoprefixer or Tailwind CSS with Jekyll.
Ruby
60
star
7

schematic

๐Ÿ“ schematic
Elixir
60
star
8

.dotfiles

My dotfiles
Lua
47
star
9

jekyll-purgecss

A Jekyll plugin for Purgecss.
Ruby
24
star
10

gen_lsp

A behaviour for creating language servers.
Elixir
21
star
11

early_return

early_return
Elixir
20
star
12

eex_compiler_visualizer

Elixir
16
star
13

everforest-textmate

Forest Night Color Scheme for editors using `tmTheme`
11
star
14

monkey

Monkey programming language interpreter implementations from the book "Writing an Interpreter in Go"
Elixir
10
star
15

contact

Instant Messaging application
Elixir
9
star
16

advent-of-code-clojure-starter

Template project for Advent of Code in Clojure.
Clojure
8
star
17

temple_phoenix

Integrates Temple and Phoenix
Elixir
7
star
18

install_fathom

Single command install of Fathom Analytics.
Shell
7
star
19

control-panel.nvim

experimental plugin, use with caution
Lua
5
star
20

advent-of-code

My Advent of Code solutions
Elixir
5
star
21

tableau

Experimental static site generator for Elixir
Elixir
5
star
22

everforest-alfred

5
star
23

silicon.lua

re-upload of 0oAstro/silicon.lua
Shell
5
star
24

blog

Jekyll source code for mitchellhanberg.com
HTML
4
star
25

pipsqueak

A modern and artisanal url shortener, with synergy.
Elixir
4
star
26

notebooks

4
star
27

sandrabbit

sandrabbit
Elixir
3
star
28

zk.nvim

Exploratory plugin for sharing my zk+fzf configuration
Lua
3
star
29

monkey.nvim

Neovim plugin for the Monkey language
Lua
3
star
30

while

Elixir
3
star
31

loop

loop
Elixir
3
star
32

thicc_forest

My Neovim Colorscheme
Lua
3
star
33

blabber

Live-coding presentation tutorial project
Elixir
3
star
34

nextls

Experimental language server for Elixir. Not for public usage.
Elixir
2
star
35

wallaby_httpoison_test

Elixir
2
star
36

tree-sitter-elixir

Tree Sitter parser for Elixir
JavaScript
2
star
37

const

Constants for Elixir!
Elixir
2
star
38

alfred-localhost

Workflow to open localhost with any port easily
2
star
39

workspace-folders.nvim

Lua
2
star
40

tableau_demo_heex

Demo showing a Tableau site using HEEx
Elixir
2
star
41

homebrew-zk

Ruby
2
star
42

tailwindcss-sketchpalette

A TailwindCSS .sketchpalette
2
star
43

wallaby_plug_demo

Example application to demonstrate using Wallaby to test a standalone JS app
Elixir
1
star
44

temple_live_view

Elixir
1
star
45

issue-test

1
star
46

follow_through

Elixir
1
star
47

Buggy-s-TV-Guide

A program for CS408 at Purdue University
Java
1
star
48

surface_playground

Elixir
1
star
49

ziglings

Zig
1
star
50

duck

what the duck
Elixir
1
star
51

one-thing-workflow

A workflow to control One Thing
1
star
52

asdf-tmux

Shell
1
star
53

CatFeeder

Ruby
1
star
54

Lunch

An app to facilitate meal improvement through data collection and metric calculation
Ruby
1
star
55

maigai

Experimental, Production Grade, Framework for Synergy
Elixir
1
star
56

lsp_codegen

Codegen for GenLSP
Elixir
1
star
57

inline_svg_test

Elixir
1
star
58

homebrew-tap

My personal homebrew tap
Ruby
1
star
59

enviro

HTML
1
star
60

ascii_dox

AsciiDoc implementation in Elixir
Elixir
1
star
61

neovim-macos-builder

Builds NeoVim artifacts for macOS
1
star
62

blabber2

"Twitter" Clone built with Aino and Temple
Elixir
1
star
63

tree-sitter-monkey

Tree Sitter parser for Monkey
C
1
star
64

workflow-test

1
star
65

daily-ui

Daily UI challenges
1
star
66

YAFBC

a silly flappy bird clone
Java
1
star
67

wallaby_bug_demo

Elixir
1
star
68

diplo

Elixir
1
star
69

seven-langs

Scala
1
star
70

wallaby_stress_test

Elixir
1
star
71

cli

the motch cli
Shell
1
star
72

wallamox

Elixir
1
star
73

.github

1
star
74

temple_example

Elixir
1
star
75

zk

A plain text note-taking assistant
Go
1
star
76

foobar

Elixir
1
star
77

temple_heex_interop

Elixir
1
star
78

isBroken.js

๐Ÿ”ฅ Modern ๐Ÿš€ Fast ๐ŸŽจ Artisanal
JavaScript
1
star
79

config_test

Elixir
1
star
80

reddit-deleter

A script to delete all of your Reddit posts and comments
Ruby
1
star
81

euler

Project Euler solutions
Ruby
1
star