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
makeLogger = (prefix) -> | |
(message) -> console.log "#{prefix.toUpperCase()}: #{message}" | |
fooLogger = makeLogger 'foo' | |
barLogger = makeLogger 'bar' | |
fooLogger n for n in [1..10] | |
barLogger n for n in [1..10] | |
fooLogger n for n in [11..20] |
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 'rubygems' | |
require 'json' | |
CONF_PATH = '/tmp/clouddial_conf.json' | |
cookbook_file CONF_PATH do | |
source File.basename CONF_PATH | |
mode '0444' | |
backup false | |
end |
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
debug = (obj, seen)-> | |
printProps = (obj)-> | |
#Edge case to handle is [1,2,3][9] = 'foo' | |
#Need to factor the conditional out to check if the prop is a number less | |
#than the array's length | |
return ((if ! /^\d+$/.test prop then prop + ": " + debug(obj[prop], seen) \ | |
else '') for prop of obj).join(', ') | |
seen = seen or [] | |
if obj in seen |
NewerOlder