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.deepEqual ['x',4], type._transformPath(['x',3], {p:['x',0], li:0}) | |
test.deepEqual ['x',3], type._transformPath(['x',3], {p:['x',5], li:0}) | |
test.deepEqual ['x',3], type._transformPath(['x',3], {p:['x',0,'x'], li:0}) | |
test.deepEqual ['x',3,'x'], type._transformPath(['x',3,'x'], {p:['x',5], li:0}) | |
test.deepEqual ['x',4,'x'], type._transformPath(['x',3,'x'], {p:['x',0], li: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
[56 of 58] Compiling Distribution.Simple.Configure ( Distribution/Simple/Configure.hs, dist/build/Distribution/Simple/Configure.o ) | |
[57 of 58] Compiling Distribution.Simple.Install ( Distribution/Simple/Install.hs, dist/build/Distribution/Simple/Install.o ) | |
[58 of 58] Compiling Distribution.Simple ( Distribution/Simple.hs, dist/build/Distribution/Simple.o ) | |
Registering Cabal-1.8.0.6... | |
Installing library in /Users/nornagon/.cabal/lib/Cabal-1.8.0.6/ghc-7.0.3 | |
Registering Cabal-1.8.0.6... | |
<command line>: cannot satisfy -package Cabal-1.10.1.0: | |
Cabal-1.10.1.0-49678efb6bfc399545e2b61629b900e2 is unusable due to missing or recursive dependencies: | |
process-1.0.1.5-107ac5b78a5845608025ca13d328fdc5 | |
(use -v for more information) |
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
obj = sharejs.open('http://foo:3300/', 'doc_name', 'json') | |
obj.on('changed', function (ev) {...}) | |
obj.at().set({}) // initial document | |
foo = obj.at('foo') | |
foo.set([0]) // { p: ['foo'], oi: [0] } | |
foo.push(3) // { p: ['foo', 1], li: 3 } | |
foo.insert(0, ['bar']) // { p: ['foo', 0], li: ['bar'] } | |
foo.get() // => [['bar'],0,3] | |
foo.at(0).push('baz') // { p: ['foo',0,1], li: 'baz' } |
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 exec = require('child_process').exec | |
function howManyOctets(cb) { | |
child = exec('snmpwalk -v 2c -c admin 192.168.0.1 IF-MIB::ifHCInOctets.1', // change to .32 to measure external usage | |
function (error, stdout, stderr) { | |
var numOctets = 0 | |
stdout.split('\n').forEach(function (line) { | |
numOctets += parseInt(/: (\d+)/.exec(stdout)[1]) | |
}) | |
cb(numOctets) |
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
$ cat foo.js | |
require('share') | |
$ ls node_modules | |
share | |
$ head node_modules/share/package.json | |
{ | |
"name": "share", | |
"version": "0.4.1", | |
"description": "A database for concurrent document editing", | |
"keywords": ["operational transformation", "ot", "concurrent", "collaborative", "database", "server"], |
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
window.atom = atom = {} | |
atom.input = { | |
_bindings: {} | |
_down: {} | |
_pressed: {} | |
_released: [] | |
bind: (key, action) -> | |
@_bindings[key] = action |
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
function getMoveFromPlayer(player_id, cb) { | |
process.spawn_child(whatever, cb) | |
} | |
function getNextMove() { | |
if (!gameStillRunning) { return } | |
getMoveFromPlayer(current_player, function (err, data) { | |
makeMove(data) | |
getNextMove() | |
}) |
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
" Opens a file in [path/to/current_file.*] that isn't already open. | |
function! RelatedFiles() | |
return filter(split(globpath(expand('%:h'), expand('%:t:r').'.*')), '!bufloaded(v:val)') | |
endfunction | |
function! OpenRelatedFile() | |
let files = RelatedFiles() | |
if len(files) > 0 | |
" always open .h files on the left. | |
if match(files[0], "\.h$") >= 0 | |
exec 'lefta vsplit '.files[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
coffee = require 'coffee-script' | |
vm = require 'vm' | |
connect = require 'connect' | |
browserChannel = require('browserchannel').server | |
comm = new (require('events').EventEmitter) | |
# TODO: sandbox | |
master = ((comm) -> | |
code = ''' |
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
<a href="http://segment.io" onclick="track('clicked on segment.io')">Yay!</a> | |
<script> | |
function track(msg) { | |
new Image().src = "http://segment.io/track?msg=" + encodeURLComponent(msg) | |
} | |
</script> |