This file contains 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 exports.GameOfLife | |
constructor: (@cells) -> @read_board() | |
evolve: -> | |
for row in [0...@size] | |
for col in [0...@size] | |
@evolve_at row, col | |
evolve_at: (@row, @col, neighbors = @neighbors()) -> |
This file contains 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
exports.Calculator = (function() { | |
function Calculator() {} | |
Calculator.prototype.square = function(x) { | |
return x * x; | |
}; | |
return Calculator; |
This file contains 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
exports.build_multiple_files_engine = (done) -> | |
add_file 'people_perf_multiple', 'common', files.common, -> | |
add_file 'people_perf_multiple', 'test', files.test_common, -> | |
add_file 'people_perf_multiple', 'test1', files.test1, -> | |
add_file 'people_perf_multiple', 'test2', files.test2, done |
This file contains 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
async.series [ | |
(done) -> fs.writeFile '/tmp/test', 'yay', -> | |
console.log 'yay!!' | |
done null | |
(done) -> | |
console.log 'hello' | |
done null | |
-> console.log 'world' | |
] |
This file contains 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
exports.benchmark = (user_options) -> | |
start user_options | |
queue = async.queue run, options.workers | |
queue.drain = finish | |
queue.push i for i in [1..options.runs] |
This file contains 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 exports.Login | |
'when a user logs in': -> true | |
'it should be greeted': -> true | |
'when #{user} logs in': (user) -> true | |
'it should say #{msg}': (msg) -> true |
This file contains 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
should = require 'should' | |
describe 'cool', -> | |
it 'is', (done) -> done() | |
it 'is not', (done) -> | |
process.nextTick -> | |
true.should.be.false |
This file contains 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
wd = require('wd'); | |
browser = wd.remote 'localhost', 9134 | |
products = [] | |
browser.init -> | |
browser.get "http://www.shopmania.es", -> | |
browser.elementById 'autocomplete_prod', (err, el)-> | |
browser.clear el, (err)-> | |
browser.type el, '3TL941C', (err)-> |
This file contains 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
fs = require 'fs' | |
process.stdin.resume() | |
rawData = fs.readSync process.stdin.fd, 100, 0, 'utf8' | |
@lines = rawData[0].split '\r\n' |
This file contains 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
# before | |
while @servers.collect { |server| server.done? }.include? false | |
# after | |
until servers.all? &:done? do |
OlderNewer