Skip to content

Instantly share code, notes, and snippets.

@satyr
satyr / fib.coffee
Created April 30, 2011 14:04 — forked from hakobe/fib.coffee
crypto = require 'crypto'
key = (values) ->
crypto.createHash('sha1').update(values.join '-').digest 'hex'
memoize = (f, memo = {}) ->
-> memo[key [this, arguments...]] ||= f.apply this, arguments
fib = memoize (n) -> if n < 2 then n else fib(n-1) + fib(n-2)
// Coco compiler wrapper for WSH
// (must be placed in the same directory as coco.js)
// Usage: cscript cowsh.js [--watch] file
// inspired by http://kennyj-jp.blogspot.com/2011/01/coffeescriptwindows.html
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var scriptPath = WScript.ScriptFullName.slice(
0, -WScript.ScriptName.length);
var Coco = new new Function(
fs.OpenTextFile(scriptPath + "coco.js", 1).ReadAll()
@satyr
satyr / README.md
Created May 20, 2011 17:37 — forked from yuya-takeyama/README.md
quick sleep sort

quick sleep sort

example usage:

$ coffee quicksleepsort.coffee 3701 45 292 9 324 45 23 123 1343
9
23

45

@satyr
satyr / gist:1080268
Created July 13, 2011 13:11 — forked from zakki/gist:1080130
FizzBuzz Scala 70B
for(n<-0 to 99)println(Seq(n+1,"Buzz","Fizz","FizzBuzz")(n%3&2|n%5/4))