Skip to content

Instantly share code, notes, and snippets.

find = (obj, id) ->
if id isnt undefined
thing for thing in obj when thing.id is id
else
obj
var find = function(obj, id) {
if(id !== undefined) {
var results;
if(obj.id === id) {
results.push(obj);
}
return results;
}
return obj;
}
# How do I add the second params to a method args after the first one being a function?
timeout = setTimeout(function() {
sys.puts('Timeout')
tweetEmitter.removeListener(listener)
}, 10000)
timeout = setTimeout ->
sys.puts 'Timeout'
tweetEmitter.removeListener listener
class Lion extends Animal
eat: (food, cb)->
cb()