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
#!/usr/bin/coffee | |
### | |
node v0.8.15 | |
### | |
# this doesn't work for setInterval either | |
class Test | |
constructor: (@text) -> |
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
#!/usr/bin/env coffee | |
### | |
in native fs, | |
we could set position from where to read, | |
but we have to track it manually | |
if run many times with position null, | |
and once with position=0, it doesn't reset to 0 |
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 Task | |
constructor: (@text) -> | |
@intervalId = null | |
hello: -> window.alert @text | |
delay: 1000 # 1 sec | |
timeout: -> |
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
var max = 10, | |
x = {vs:') versus '}; | |
for (var i=0; i<max; i++) { | |
console.log('i: ', i); | |
setTimeout((function(number) { console.log('i(' + i + this.vs + number); }).bind(x), (i * 500), i); | |
} |
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
#!/usr/bin/env coffee | |
class Test | |
constructor: (cb) -> cb(@) | |
hello: -> console.log 'Hello, World!' | |
cb = (obj) -> obj.hello() | |
test = new Test cb |
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
#!/bin/sh | |
find "$(pwd -P)" -type f \( -name "*~" -o -name ".*~" \) -exec rm -vf {} + |
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
#!/usr/bin/env coffee | |
MAX_CALLS = 10 | |
class Test | |
constructor: -> | |
@reset() | |
run1: (returnFn) -> | |
@count += 1 | |
console.log 'A| count:', @count |
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
// test page - https://github.com/PlzenskyHackathon2013/ | |
// written on Firefox with FireBug | |
var teams = []; | |
$x("//h3/a/text()").forEach(function (item) { | |
teams.push(item.textContent); | |
}); | |
console.log(teams); |
OlderNewer