# vimtutor
vim ~/.vimrc
in vim
var exitCode = 0; | |
process.on("exit", onExit); | |
function onExit() { | |
//process.removeListener("exit", onExit); // redundant | |
process.exit(exitCode); | |
} | |
exitCode = 3; |
// 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); |
#!/usr/bin/env coffee | |
MAX_CALLS = 10 | |
class Test | |
constructor: -> | |
@reset() | |
run1: (returnFn) -> | |
@count += 1 | |
console.log 'A| count:', @count |
#!/bin/sh | |
find "$(pwd -P)" -type f \( -name "*~" -o -name ".*~" \) -exec rm -vf {} + |
#!/usr/bin/env coffee | |
class Test | |
constructor: (cb) -> cb(@) | |
hello: -> console.log 'Hello, World!' | |
cb = (obj) -> obj.hello() | |
test = new Test cb |
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); | |
} |
class Task | |
constructor: (@text) -> | |
@intervalId = null | |
hello: -> window.alert @text | |
delay: 1000 # 1 sec | |
timeout: -> |
#!/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 |