CAUTION - in examples by tilde (~) we mean a directory where you cloned the repository.
~ $ mix test| 1. Ask, don't assume. If something is unclear, ask before writing a single line. Never make silent assumptions about intent, architecture, or requirements. When running unattended, pick the most reasonable interpretation, proceed, and record the assumption rather than blocking. | |
| 2. Implement the simplest solution for simple problems, better solutions for harder problems. Do not over-engineer or add flexibility that isn't needed yet. | |
| 3. Don't touch unrelated code but please do surface bad code or design smells you discover with me so we can address them as a separate issue. | |
| 4. Flag uncertainty explicitly. If you're unsure about something, see point 1 above. If it makes sense to do so, conduct a small, localised and low-risk experiment and bring the hypothesis and results to me to discuss. Confidence without certainty causes more damage than admitting a gap. | |
| 5. I'm always open to ideas on better ways to do things. Please don't hesitate to suggest a better way, or one that has long lasting impact over a tact |
| /** | |
| * Returns a Promise which resolves with a value in form of a tuple. | |
| * @param promiseFn A Promise to resolve as a tuple. | |
| * @returns Promise A Promise which resolves to a tuple of [error, ...results] | |
| */ | |
| export function tuple (promise) { | |
| return promise | |
| .then((...results) => [null, ...results]) | |
| .catch(error => [error]) | |
| } |
| defmodule AdventOfCode2021.Day02 do | |
| @moduledoc """ | |
| --- Day 2: Dive! --- | |
| Now, you need to figure out how to pilot this thing. | |
| It seems like the submarine can take a series of commands like forward 1, down 2, or up 3: | |
| forward X increases the horizontal position by X units. | |
| down X increases the depth by X units. | |
| up X decreases the depth by X units. |
| defmodule AdventOfCode2021.Day01 do | |
| @moduledoc """ | |
| --- Day 1: Sonar Sweep --- | |
| You're minding your own business on a ship at sea when the overboard alarm goes off! You rush to see if you can help. Apparently, one of the Elves tripped and accidentally sent the sleigh keys flying into the ocean! | |
| Before you know it, you're inside a submarine the Elves keep ready for situations like this. It's covered in Christmas lights (because of course it is), and it even has an experimental antenna that should be able to track the keys if you can boost its signal strength high enough; there's a little meter that indicates the antenna's signal strength by displaying 0-50 stars. | |
| Your instincts tell you that in order to save Christmas, you'll need to get all fifty stars by December 25th. | |
| Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck! |
| ### Keybase proof | |
| I hereby claim: | |
| * I am 0x6a68 on github. | |
| * I am 0x6a68 (https://keybase.io/0x6a68) on keybase. | |
| * I have a public key ASDmTfB7x8vU9rkTy_x_SXJaUEa9n9GL_TXswurkjJXSRwo | |
| To claim this, I am signing this object: |
| version: '2' | |
| services: | |
| postgres: | |
| image: postgres:9.5 | |
| restart: always | |
| environment: | |
| - "POSTGRES_USER=${POSTGRES_USER}" | |
| - "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}" | |
| - "POSTGRES_DB=gogs" | |
| volumes: |
| { | |
| "*.tsx": { | |
| "alternate": "{dirname}/__tests__/{basename}.test.tsx", | |
| "type": "source", | |
| "template": [ | |
| "import type {open} FC {close} from 'react';", | |
| "", | |
| "type {basename|camelcase|capitalize}Props = {open}", | |
| " property?: unknown;", | |
| "{close};", |
| defmodule MyApp.Foo do | |
| @on_definition MyApp.SpecToCallback | |
| @spec bar(String.t()) :: String.t() | |
| def bar(foobar) do | |
| impl().bar(foobar) | |
| end | |
| defp impl, do: Application.get_env(:my_app, :my_app_foo_impl, __MODULE__.DefaultImpl) | |
| end |
| module Main exposing (main) | |
| import Graphqelm.Operation exposing (RootQuery) | |
| import Graphqelm.Http | |
| import Graphqelm.SelectionSet exposing (SelectionSet, with) | |
| import Html exposing (Html, a, div, h1, h2, p, pre, text) | |
| import RemoteData exposing (RemoteData) | |
| import Github.Object | |
| import Github.Object.User as User | |
| import Github.Query as Query |