This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
. "fmt" | |
"http" | |
) | |
func handler(c *http.Conn, r *http.Request) { | |
Fprintf(c, "Hi there, I love %s!", r.URL.Path[1:]) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sdl" | |
"gl" | |
"time" | |
. "math" | |
. "fmt" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "math" | |
type Point struct { | |
x int | |
y int | |
} | |
func (p0 Point) distanceTo(p1 Point) float64{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"gl" | |
"sdl" | |
) | |
func main() { | |
if sdl.Init(sdl.INIT_VIDEO) < 0 { | |
panic("Video initialization failed: " + sdl.GetError()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bacon: { | |
contexts: [] | |
errors: [] | |
} | |
Bacon.describe: (name, context) -> | |
@contexts.push([name, context]) | |
assume: (code) -> | |
if code() isnt true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('../oxid') | |
bacon: require('../bacon') | |
sys: require('sys') | |
assert: require('assert') | |
Array.prototype.compareArrays: (arr) -> | |
if @length != arr.length | |
return false | |
for elem, i in arr | |
if elem.compareArrays # likely nested array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = Void program:Program Void { return program } | |
Void = Space* | |
Space "Space" = [\t ]+ | |
Stop "Stop" = [\n\r;]+ Void | |
EOF "End of File" = !. | |
Comment "Comment" = c:"#" t:(&[^\n\r] .)* (Stop / EOF) { | |
return c + t.map(function(a){ return a[1] }).join("") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String << = (other| | |
self concat: other | |
) | |
String from:to: = (start end| | |
temp = "" | |
(start to: end) do: [i| | |
char = self at: i | |
(char == nil) unless: [| | |
temp concat: char |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Morse = Object clone | |
Morse translation-table = [ | |
"A", ".-" | |
"B", "-..." | |
"C", "-.-." | |
"D", "-.." | |
"E", "." | |
"F", "..-." | |
"G", "--." | |
"H", "...." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integer bottles = (| | |
(self == 0) if: [| | |
"No more bottles" | |
] else: [| | |
(self == 1) if: [| | |
"1 bottle of beer" | |
] else: [| | |
(self to-s) + " bottles of beer" | |
] | |
] |