Skip to content

Instantly share code, notes, and snippets.

@mmalecki
mmalecki / fast-json-stream.js
Created February 14, 2012 15:03
Sort of.
var util = require('util'),
Stream = require('stream');
var FastJSONStream = exports.FastJSONStream = function (options) {
this.bufferSize = options.bufferSize;
this._buffer = new Buffer(this.bufferSize);
};
util.inherits(FastJSONStream, Stream);
FastJSONStream.prototype.write = function (chunk) {
@mmalecki
mmalecki / bootstrap.sh
Created February 15, 2012 12:36
My little project bootstrapper
#!/bin/sh
read -p 'Project name: ' project_name
cat > .gitignore <<EOF
npm-debug.log
node_modules
.DS_Store
.*.sw[op]
EOF
@mmalecki
mmalecki / gist:1845715
Created February 16, 2012 15:41
node@ce485791db5507d160cbc204b8a58e770ac60a50 test results, Mac OS X
[maciej@pc07 node (master)]$ make test
make -C out BUILDTYPE=Release
make[1]: Nothing to be done for `all'.
ln -fs out/Release/node node
python tools/test.py --mode=release simple message
=== release test-fs-watch ===
Path: simple/test-fs-watch
Command: out/Release/node /Users/maciej/dev/JavaScript/node/test/simple/test-fs-watch.js
--- TIMEOUT ---
=== release test-http-full-response ===
[maciej@PC04 node]$ gdb --args ./node deps/npm/cli.js
GNU gdb (GDB) Fedora (7.2-52.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
[maciej@PC04 node-g]$ gdb --args ./node deps/npm/cli.js
GNU gdb (GDB) Fedora (7.2-52.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
GNU gdb (GDB) Fedora (7.2-52.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /mnt/Data/Maciej/Programowanie/src/node-g/node...done.
@mmalecki
mmalecki / package.json
Created March 12, 2012 13:16
private packages on nodejitsu
{
"name": "super-secretz",
"dependencies": {
"secretz": "git+ssh://[email protected]:secretz/secretz.git"
},
"bundleDependencies": [ "secretz" ]
}
@mmalecki
mmalecki / gist:2070387
Created March 18, 2012 10:24
OH #nodejitsu
13:20 < Nexxy> mmalecki, I experienced OC spray today!
13:21 <+mmalecki> Nexxy: why would you even
13:21 < Nexxy> I wanted to make sure it worked
13:22 < Nexxy> it... it works.
13:22 <+mmalecki> what.
13:22 < Nexxy> I bought OC spray for my waifu and I and I read that you should test them to make sure they work
13:22 < Nexxy> so I did.
13:22 < Nexxy> and they do.
13:22 < Nexxy> really well.
13:23 < Nexxy> so well I had to take a nap after I was done choking
var fs = require('fs');
fs.readFile('file', function (ಠ_ಠ, data) {
if (ಠ_ಠ) {
console.log("Node does not approve");
}
});
@mmalecki
mmalecki / zero-downtime.js
Created May 24, 2012 12:29
Quick and dirty zero-downtime process restart
var http = require('http'),
fork = require('child_process').fork;
var serverHandle, server;
function log(l) {
console.log(process.pid + ': ' + l);
}
process.on('SIGUSR2', function () {