Skip to content

Instantly share code, notes, and snippets.

$ git clone git://github.com/visionmedia/express.git
Initialized empty Git repository in /home/gsf/git/express/.git/
remote: Counting objects: 5043, done.
remote: Compressing objects: 100% (2059/2059), done.
remote: Total 5043 (delta 3006), reused 4923 (delta 2898)
Receiving objects: 100% (5043/5043), 637.16 KiB, done.
Resolving deltas: 100% (3006/3006), done.
$ cd express/
$ grep -rl posix .
./spec/node.js
// name, attrs, content, callback
libxml.Element.Arguments = function(args) {
var ret_args = null;
switch (args.length) {
case 1:
ret_args = [args[0], null, null, null];
break;
case 2: // name, callback; name, attrs; name, content
node> var id = [];
[]
node> id.constructor
[Function]
node> id.constructor.toString()
'function Array() { [native code] }'
node> id.constructor === Array
true
node>
if (idx == 0) {
$('element').addClass('bob');
return '#nav-print a';
}
class RowDict(dict):
"""
Subclass of dict that joins sequences and encodes to utf-8 on get.
Encoding to utf-8 is necessary for Python's csv library because it
can't handle unicode.
>>> row = RowDict()
>>> row['bob'] = ['Montalb\\xe2an, Ricardo', 'Roddenberry, Gene']
>>> row.get('bob')
'Montalb\\xc3\\xa1n, Ricardo|Roddenberry, Gene'
>>> print row.get('bob')
@gsf
gsf / gist:899830
Created April 2, 2011 20:03
vimrc
if has("autocmd")
filetype plugin indent on
endif
set expandtab
set hidden
set incsearch
set noshowmatch
set showcmd
set smartcase
@gsf
gsf / gist:1036573
Created June 20, 2011 21:02
phlapi
// possible ideal for handling sanitation districts
var address = $('#addressInput').val();
phl.sanDis(address, function(districts) {
$.each(districts, function(index, value) {
$('ul').append('<li>'+value+'</li>');
});
});
@gsf
gsf / gist:1037776
Created June 21, 2011 12:41
supybot thrash and die
INFO 2011-06-21T05:40:56 supybot Reconnecting to freenode at 2011-06-21T05:45:56.
WARNING 2011-06-21T05:40:56 supybot Scheduling a second reconnect when one is already scheduled. This
is a bug; please report it, with an explanation of what caused this to happen.
WARNING 2011-06-21T05:40:56 supybot Disconnect from verne.freenode.net:6667: error: [Errno 32] Broken
pipe.
INFO 2011-06-21T05:40:56 supybot Reconnecting to freenode at 2011-06-21T05:45:56.
WARNING 2011-06-21T05:40:56 supybot Scheduling a second reconnect when one is already scheduled. This
is a bug; please report it, with an explanation of what caused this to happen.
WARNING 2011-06-21T05:40:56 supybot Disconnect from verne.freenode.net:6667: error: [Errno 32] Broken
pipe.
@gsf
gsf / gist:1336733
Created November 3, 2011 15:11
Node.js Summon portal
var crypto = require('crypto');
var http = require('http');
var querystring = require('querystring');
var url = require('url');
var util = require('util');
var accessID = 'xxxxx';
var key = 'xxxxxxxxxx';
var host = 'api.summon.serialssolutions.com';
var summon = http.createClient(80, host);
@gsf
gsf / gist:1349195
Created November 8, 2011 20:58
coffeescript syntax annoyance
# the function below is called because it is followed by a space and a parameter
robot.load scriptsPath
# the function below will not be called
robot.run
# it must look like this
robot.run()
# i'd rather have a few more parentheses than this brain-jarring inconsistency