• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Elixir
  • Created almost 6 years ago
  • Updated over 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
108
star
5

schematic

πŸ“ schematic
Elixir
82
star
6

output-panel.nvim

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

jekyll-postcss

A plugin to use PostCSS plugins like Autoprefixer or Tailwind CSS with Jekyll.
Ruby
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`
13
star
14

monkey

Monkey programming language interpreter implementations from the book "Writing an Interpreter in Go"
Elixir
11
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

silicon.lua

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

everforest-alfred

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

workspace-folders.nvim

Lua
4
star
28

sandrabbit

sandrabbit
Elixir
3
star
29

zk.nvim

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

monkey.nvim

Neovim plugin for the Monkey language
Lua
3
star
31

while

Elixir
3
star
32

loop

loop
Elixir
3
star
33

thicc_forest

My Neovim Colorscheme
Lua
3
star
34

blabber

Live-coding presentation tutorial project
Elixir
3
star
35

const

Constants for Elixir!
Elixir
2
star
36

nextls

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

tree-sitter-elixir

Tree Sitter parser for Elixir
JavaScript
2
star
38

wallaby_httpoison_test

Elixir
2
star
39

alfred-localhost

Workflow to open localhost with any port easily
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

hackery

Blog and website template for Tableau
Elixir
2
star
44

wallaby_plug_demo

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

temple_live_view

Elixir
1
star
46

issue-test

1
star
47

follow_through

Elixir
1
star
48

Buggy-s-TV-Guide

A program for CS408 at Purdue University
Java
1
star
49

surface_playground

Elixir
1
star
50

ziglings

Zig
1
star
51

duck

what the duck
Elixir
1
star
52

one-thing-workflow

A workflow to control One Thing
1
star
53

CatFeeder

Ruby
1
star
54

maigai

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

lsp_codegen

Codegen for GenLSP
Elixir
1
star
56

inline_svg_test

Elixir
1
star
57

homebrew-tap

My personal homebrew tap
Ruby
1
star
58

enviro

HTML
1
star
59

ascii_dox

AsciiDoc implementation in Elixir
Elixir
1
star
60

neovim-macos-builder

Builds NeoVim artifacts for macOS
1
star
61

Lunch

An app to facilitate meal improvement through data collection and metric calculation
Ruby
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

foobar

Elixir
1
star
76

temple_heex_interop

Elixir
1
star
77

isBroken.js

πŸ”₯ Modern πŸš€ Fast 🎨 Artisanal
JavaScript
1
star
78

config_test

Elixir
1
star
79

reddit-deleter

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

euler

Project Euler solutions
Ruby
1
star