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
find = (obj, id) -> | |
if id isnt undefined | |
thing for thing in obj when thing.id is id | |
else | |
obj |
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
var find = function(obj, id) { | |
if(id !== undefined) { | |
var results; | |
if(obj.id === id) { | |
results.push(obj); | |
} | |
return results; | |
} | |
return obj; | |
} |
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
# 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 |
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
class Lion extends Animal | |
eat: (food, cb)-> | |
cb() |
NewerOlder