Skip to content

Instantly share code, notes, and snippets.

https://gist.github.com/murphyrandle/ae9a3bccea188da066c7#file-error
var foo = {
a: 'a',
b: 'b'
}
foo.c = 'c' // Flow errors here saying: Property not found in object literal
@mrmurphy
mrmurphy / config.json
Last active August 29, 2015 14:18 — forked from anonymous/config.json
Config for Winnower
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#82A6C9",
"@brand-success": "#30D8B4",
@mrmurphy
mrmurphy / Main.elm
Created November 26, 2015 18:00
Homespunn Elm Router using the Elm application architecture
module Main where
import StartApp as StartApp
import Task
import Effects exposing (Never, Effects)
import History
import Signal
import Html exposing (Html, text)
import Debug
import Time

I defined a custom type:

type alias Props =
  { user: SafeUser
  , onEdit: Signal.Address String
  , products: List Product
  , flash: String
  }
module Dnd (..) where
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import StartApp.Simple exposing (start)
import Signal exposing (message, Address)
import Json.Decode
module FancyParse (..) where
import Html exposing (div, text)
import Json.Decode exposing (object2, string, (:=), value, customDecoder, Decoder, decodeString)
type alias Foo =
{ a : String
, json : String
}
module Inversions (countInversions, mergeAndCount) where
import List.Extra exposing (splitAt)
import List exposing (length, sort, foldl, concat, head)
import Maybe.Extra exposing (isNothing, map2)
mergeAndCount : List Int -> List Int -> ( List Int, Int )
mergeAndCount left right =
let
@mrmurphy
mrmurphy / prepend.bash
Created May 27, 2016 16:45
Insert a line at the beginning of files matching search pattern
# Requires siver-searcher to be installed
FILES=$(ag "<search term here, can be regex>" -l --js)
for i in $FILES; do
echo -e "<stuff to prepend here>\n$(cat $i)" > $i
done
@mrmurphy
mrmurphy / Main.elm
Created June 20, 2016 12:46
Decoding Ints
import Html exposing (text)
import Json.Decode exposing (Decoder, decodeString, list, int)
-- Define a "recipe" (decoder)
-- Execute the recipe (decoder)
-- Result x a = Err x | Ok a
num = "4"
nums = "[1,3,5,6,7]"