Skip to content

Instantly share code, notes, and snippets.

server:
port: 1337
db:
sqlite:
filename: ':memory:'
http.js:851
throw new TypeError('first argument must be a string or Buffer');
^
TypeError: first argument must be a string or Buffer
at ServerResponse.OutgoingMessage.write (http.js:851:11)
at write (/Users/jerry/work/http-db/node_modules/levelup/node_modules/readable-stream/lib/_stream_readable.js:605:24)
at flow (/Users/jerry/work/http-db/node_modules/levelup/node_modules/readable-stream/lib/_stream_readable.js:614:7)
at ReadStream.pipeOnReadable (/Users/jerry/work/http-db/node_modules/levelup/node_modules/readable-stream/lib/_stream_readable.js:646:5)
at ReadStream.emit (events.js:92:17)
at emitReadable_ (/Users/jerry/work/http-db/node_modules/levelup/node_modules/readable-stream/lib/_stream_readable.js:430:10)
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install' ]
2 info using npm@2.6.0
3 info using node@v1.4.1
4 verbose node symlink /usr/local/bin/node
5 verbose install where, deps [ '/Users/jerry/work/koop',
5 verbose install [ 'async',
5 verbose install 'aws-sdk',
5 verbose install 'body-parser',
5 verbose install 'config',
#!/usr/bin/env node
var wkt = require('terraformer-wkt-parser'),
arcgis = require('terraformer-arcgis-parser'),
fs = require('fs');
var argv = require('optimist')
.usage('Usage: $0 --in-format [format] --out-format [format] infile [outfile]')
.demand(['in-format','out-format'])
.check(function (argv) {
{
"type": "Polygon",
"coordinates": [ [ [ -122, 45 ], [ -123, 45 ], [ -123, 46 ], [ -122, 46 ], [ -122, 45 ] ] ]
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JerrySievert
JerrySievert / gist:973725
Created May 16, 2011 00:38
test for jsdom src attribute
env_with_src : function() {
var
html = "<html><body><p>hello world!</p></body></html>",
src = "window.attachedHere = 123";
jsdom.env({
html : html,
src : src,
done : function(errors, window) {
assertNull("error should not be null", errors);
@JerrySievert
JerrySievert / bug.css
Created May 20, 2011 21:55
stylus bug
table {
width: 600px;
}
table thead tr th {
text-align: center;
font-weight: bold;
}
table tbody tr:nth-child(odd) {
background-color: #fff;
}
@JerrySievert
JerrySievert / gist:1003522
Created June 1, 2011 22:32
buffer conversion node.js
node::Buffer *slowBuffer = node::Buffer::New(len);
memcpy(node::Buffer::Data(slowBuffer), get, len);
v8::Local<v8::Object> globalObj = v8::Context::GetCurrent()->Global();
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(v8::String::New("Buffer")));
v8::Handle<v8::Value> constructorArgs[3] = { slowBuffer->handle_, v8::Integer::New(len), v8::Integer::New(0) };
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
return scope.Close(actualBuffer);
@JerrySievert
JerrySievert / gist:1015588
Created June 8, 2011 22:24
simple node.js router
var url = require('url');
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var parsed = url.parse(req.url, true);
var pathname = parsed.pathname;
res.end('Hello World, you asked for: ' + pathname + '\n');
}).listen(1337, "127.0.0.1");