Skip to content

Instantly share code, notes, and snippets.

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)
}
$ cat test.ooc
use test
$ cat test.use
Name: test
Description: LibPaths test library
Version: 0.1
SourcePath: .
LibPaths: .
test: func (f: Func()) {
f()
}
main: func {
i := 0
test(||
// Uncomment the next line and all issues disappear.
//i toString() println()
Foo: cover from Int {
new: static func (i: Int) -> This {
i
}
println: func {
"%d" printfln(this)
}
}
package cont
modules = main
opts = "--codegen javascript -o cont.js"
@ajhager
ajhager / main.go
Created November 2, 2014 16:48
GopherJS Gist Test
package main
func main() {
println("HELLO GIST!")
}
@ajhager
ajhager / main.elm
Created November 2, 2014 23:20
Test elm package
main : Element
main = plainText "Hello, World!"
@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 / 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

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: