This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias w 'save' | |
alias wq 'save; quit' | |
alias q 'quit' | |
alias q! 'quit -f' | |
set statusline-left ' %i%S%f%s%m%s%r%s%M' | |
def-mode -u vi-normal | |
bind -T vi-normal j down | |
bind -T vi-normal k up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def score(rolls) = score_helper(0, 1, rolls.reverse) | |
def score_helper(sum, frame, remaining) | |
case remaining | |
in 10, 10, x if frame == 10 && x <= 10 then sum + 20 + x | |
in 10, x, y if frame == 10 && x + y <= 10 then sum + 10 + x + y | |
in x, y, z if frame == 10 && x + y == 10 && z <= 10 then sum + x + y + z | |
in x, y if frame == 10 && x + y < 10 then sum + x + y | |
in 10, x, y, *rest then score_helper(sum + 10 + x + y, frame + 1, [x, y, *rest]) | |
in x, y, z, *rest if x + y == 10 && z <= 10 then score_helper(sum + 10 + z, frame + 1, [z, *rest]) | |
in x, y, *rest if x + y <= 10 then score_helper(sum + x + y, frame + 1, rest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let score game = | |
let rec aux sum frame = | |
function | |
| 10 :: 10 :: [ x ] when frame = 10 && x <= 10 -> Some(sum + 20 + x) | |
| 10 :: x :: [ y ] when frame = 10 && x + y <= 10 -> Some(sum + 10 + x + y) | |
| x :: y :: [ z ] when frame = 10 && x + y = 10 && z <= 10 -> Some(sum + 10 + z) | |
| x :: [ y ] when frame = 10 && x + y < 10 -> Some(sum + x + y) | |
| 10 :: x :: y :: rest -> aux (sum + 10 + x + y) (frame + 1) (x :: y :: rest) | |
| x :: y :: z :: rest when x + y = 10 && z <= 10 -> aux (sum + 10 + z) (frame + 1) (z :: rest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
FOO = 1 | |
BAR = 'bar' | |
def call | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns advent-of-code-year-2022.day-01 | |
"Advent of Code - Solution to year 2022, day 1." | |
(:require | |
[clojure.string :as str])) | |
(def sample-input | |
"1000 | |
2000 | |
3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "core:io" | |
import "core:strings" | |
import "core:testing" | |
freq :: proc(stream: io.Stream) -> (res: int) { | |
base :: 10 | |
sign := 1 | |
num: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
) | |
func main() { | |
s := bufio.NewScanner(os.Stdin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -e | |
dark_theme="Andromeda" | |
light_theme="Solarized Light" | |
while true; do | |
if defaults read -g AppleInterfaceStyle &>/dev/null; then | |
if [ $(< $HOME/.current-theme) = "dark" ]; then | |
continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -REho --include \*.rb '\b[A-Z_]+\b\s*=' . | tr -d '=' | cut -d' ' -f1 | sort | uniq -u | xargs -I{} bash -c 'if [[ $(grep -Rhow --include \*.rb "{}" . | wc -l) -eq 1 ]] ; then echo {} ; fi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Year2022.Day05 exposing (..) | |
import Aoc.Problem exposing (Answer(..), Input, Solution) | |
import Array exposing (Array) | |
import List.Extra as List | |
import Parser exposing ((|.), (|=), Parser, Step(..), andThen, chompIf, chompWhile, getChompedString, int, keyword, loop, map, oneOf, succeed, symbol) | |
type alias Crate = | |
String |
NewerOlder