Skip to content

Instantly share code, notes, and snippets.

View z5h's full-sized avatar
🕳️

Mark Bolusmjak z5h

🕳️
View GitHub Profile
module TimeApp ( start, Config, App ) where
{-| This module helps you start your application in a typical Elm workflow.
It assumes you are following [the Elm Architecture][arch] and using
[elm-effects][]. From there it will wire everything up for you!
**Be sure to [read the Elm Architecture tutorial][arch] to learn how this all
works!**
[arch]: https://github.com/evancz/elm-architecture-tutorial
[elm-effects]: http://package.elm-lang.org/packages/evancz/elm-effects/latest
#lang scheme
(define grammar1
'((T (R))
(T ("a" T "c"))
(R ())
(R (R "b" R))))
(define grammar2
'((T (R))
@z5h
z5h / Swap.elm
Created July 24, 2015 17:23
Elm rendering focus loss
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
type Action
= NoOp
| EditEntry Entry String
type alias Entry =

Keybase proof

I hereby claim:

  • I am z5h on github.
  • I am bolusmjak (https://keybase.io/bolusmjak) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

@z5h
z5h / update.js
Last active August 29, 2015 14:13
Get the result of updating a Javascript object while treating it as immutable.
/**
* Get the result of updating `obj` with `props`, while treating `obj`
* as immutable.
*/
var update = function(obj, props){
var keys = Object.keys(props),
key,
changed = false,
i;
@z5h
z5h / join-on
Last active August 29, 2015 14:05
does a join on 2 files based on 1st capture of regex. e.g.: join-on Gemfile "gem '([^']*)'" Gemfile.lock " *([^ ]*)"
#!/usr/bin/env ruby
# example use: join-on Gemfile "gem '([^']*)'" Gemfile.lock " *([^ ]*)"
file1, cap1, file2, cap2 = *ARGV
r1 = Regexp.new(cap1)
r2 = Regexp.new(cap2)
line_match_number = []
n = 0
max_len = 0
File.open(file1).each do |line|