Skip to content

Instantly share code, notes, and snippets.

View tryggvigy's full-sized avatar
🌚
Web developer at Spotify working on Web Player and Desktop clients

Tryggvi Gylfason tryggvigy

🌚
Web developer at Spotify working on Web Player and Desktop clients
  • Spotify
  • Stockholm, Sweden
View GitHub Profile
@tryggvigy
tryggvigy / day1.ml
Created December 1, 2017 21:00
Advent Of Code - Day 1
open Core.Std
let solveCaptcha digits =
let rec loop ls sum = match ls with
| hd::[] when (List.hd_exn digits) = hd -> sum + hd
| hd::sd::tl when hd = sd -> loop (sd::tl) (sum + hd)
| hd::tl -> loop tl sum
| _ -> sum
in
loop digits 0
@tryggvigy
tryggvigy / dropdown.md
Last active September 15, 2017 13:30
Useful saved replies, view raw to copy markup. These are nice to have in your https://github.com/settings/replies

Dropdown

The markup

Title

  • list
  • with
    • nested
    • items
@tryggvigy
tryggvigy / flow_examples.md
Last active December 12, 2016 23:05
Flow playground links for provided example

Note

https://flowtype.org/try is broken since the flow team pushed v0.36.0 three hours ago. 😕 I filed an issue here: facebook/flow#3003 To run any of the below examples, alter the version dropdown in to top right to v0.36.0

countdownToChristmas

Flow can actually infer the parameter and return types of the function: https://flowtype.org/try/#0GYVwdgxgLglg9mABBO4oBM4HcwBU4DCAFgE4wDOUAtgIbkAU6NUApgJSIDeAUIsgpURMAnuQAyLYFEQBeRACYALIgC0Q5i269EMYIkY1REqYgB8iAAwcefPiRZQQJJAAMAJJxHjJUAL7rRRFgAG2DEYjJKWnIAQhdtX25E7hQwQSZWWUQwFixEABENejYAOgBzB0LWYpTUMAxsPEJSCmo6A1ZSqDgAVQAHPpYSAjoWYqA

@tryggvigy
tryggvigy / lodash.js
Last active May 24, 2016 00:09
lodash array methods type specifications
// @flow
type Iteratee<T> = Array<string> | {[key: string]: T} | string
// Try and fix this
type Iteratee$Weak<T> = Array<string> | {[key: string]: T} | string | Function
type Collection<T> = Array<T> | {[key: string]: T}
declare module 'lodash' {
declare var VERSION: string
// @flow
type Iteratee<T> = Array<string> | {[key: string]: T} | string
// Try and fix this
type Iteratee$Weak<T> = Array<string> | {[key: string]: T} | string | Function
type Collection<T> = Array<T> | {[key: string]: T}
declare module 'lodash' {
/**