Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ajhager on github.
  • I am ajhager (https://keybase.io/ajhager) on keybase.
  • I have a public key ASDZav03KPYssImthAiX25rH2xRZfRKc206AK_rwduRfego

To claim this, I am signing this object:

@ajhager
ajhager / Flag.elm
Last active August 29, 2015 14:26
Applicative style API for a flag parsing module in the upcoming github.com/elmcast/elm-node
module Flag where
type Parser a = Parser
parse : Parser a -> Result String a
parseWith : Parser a -> List String -> Dict String String -> Result String a
parsing : (a -> b) -> Parser (a -> b)
withOpt : Parser (a -> b) -> Parser a -> Parser b
withArg : Parser (a -> b) -> Parser a -> Parser b
withEnv : Parser (a -> b) -> Parser a -> Parser b
@ajhager
ajhager / Main.elm
Last active August 29, 2015 14:26
Custom Elm Renderers
module Main where
import MyEngine
myView : Signal (MyEngine.NewElement)
myView = Signal.constant (MyEngine.Div "Hello")
port engine : Task x ()
port engine = MyEngine.render myView
@ajhager
ajhager / main.elm
Created November 2, 2014 23:20
Test elm package
main : Element
main = plainText "Hello, World!"
@ajhager
ajhager / main.go
Created November 2, 2014 16:48
GopherJS Gist Test
package main
func main() {
println("HELLO GIST!")
}
package cont
modules = main
opts = "--codegen javascript -o cont.js"
Foo: cover from Int {
new: static func (i: Int) -> This {
i
}
println: func {
"%d" printfln(this)
}
}
test: func (f: Func()) {
f()
}
main: func {
i := 0
test(||
// Uncomment the next line and all issues disappear.
//i toString() println()
$ cat test.ooc
use test
$ cat test.use
Name: test
Description: LibPaths test library
Version: 0.1
SourcePath: .
LibPaths: .
Vec2: class {
x, y: Float
init: func (=x, =y)
repr: func -> String { "Vec2(%.2f, %.2f)" format(x, y) }
}
operator * (left: Float, right: Vec2) -> Vec2 {
return Vec2 new(left * right x, left * right y)
}