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
" 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 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
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 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
window.atom = atom = {} | |
atom.input = { | |
_bindings: {} | |
_down: {} | |
_pressed: {} | |
_released: [] | |
bind: (key, action) -> | |
@_bindings[key] = action |
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
$ 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 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
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 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
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 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
[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 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
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 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
function! Thing() | |
py << EOF | |
import vim, thread, time | |
def go(): | |
time.sleep(2) | |
vim.current.buffer[0] = "foo" | |
thread.start_new_thread(go, ()) | |
EOF | |
endfunction |
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
" duh | |
syn on | |
filetype plugin indent on | |
" the only TRUE tab settings | |
set ts=2 sw=2 noet tw=79 ai smarttab | |
" keep 4 lines between the cursor and the edge of the screen where possible | |
set so=4 |