Skip to content

Instantly share code, notes, and snippets.

# Doxyfile 1.5.5
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
var Class = require('./class').Class; // tested with v0.3.0-3-e1e4628 @ http://github.com/visionmedia/class.js
var LeafNode = new Class({
constructor: function(order){
this.order = order;
this.isLeafNode = true;
this.isInternalNode = false;
this.parentNode = null;
@mscdex
mscdex / node_debian_init.sh
Created August 6, 2011 09:33 — forked from peterhost/node_debian_init.sh
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@mscdex
mscdex / bench.js
Created April 12, 2012 17:23 — forked from xk/bench.js
When threads_a_gogo beats node 2 to 1.... or does it?
/*
$ node bench.js
Threads_a_gogo JS thread -> 3039 (ms) 298607040
Node's main JS thread -> 4677 (ms) 298607040
Ratio: 1.54 times faster than main JS thread
New, separate VM -> 3065 (ms) 298607040
Ratio: 1.01 times faster than new VM
*/
@mscdex
mscdex / gist:4463223
Last active December 10, 2015 16:48
node binary install one-liner for *nix
Linux 32-bit: curl http://nodejs.org/dist/latest/node-v0.10.29-linux-x86.tar.gz | tar zx --strip=1 -C /usr/local
Linux 64-bit: curl http://nodejs.org/dist/latest/node-v0.10.29-linux-x64.tar.gz | tar zx --strip=1 -C /usr/local
@mscdex
mscdex / readstream.js
Last active December 15, 2015 10:08
streams2 ReadStream that uses callbacks instead of a combination of 'readable' event listening and read()
var ReadableStream = require('stream').Readable;
var EMPTY_CALLBACK = function(n) {};
function ReadStream(cfg) {
if (!(this instanceof ReadStream))
return new ReadStream();
var self = this;
this._callbacks = [];
@mscdex
mscdex / gist:5329227
Last active December 9, 2017 12:48
Why the IMAP protocol sucks
1. You cannot fetch .TEXT, .HEADER, etc. for parts that are not of type message/rfc822
2. Gotchas with multiple asynchronous requests
3. Response to partial body fetch does not include originally requested range, only the starting byte number
4. Fragmented fetch responses (servers are not required to collect all requested pieces of information for a particular message into a single response)
5. LIST can display child mailboxes before their parents
6. FETCHing a comma-separated list of messages (UIDs or seqnos) does not necessarily result in FETCH responses in that same order
7. Untagged FETCH responses containing FLAG updates can be sent for messages not requested *during* a FETCH request.
@mscdex
mscdex / example.js
Created May 16, 2013 20:18
DataTables plug-in for displaying sort priorities in each sorted column header
$('#example').dataTable().fnSortPriorities();
@mscdex
mscdex / gist:8493112
Created January 18, 2014 16:55
Use npm API from system copy of npm
function loadNpm(cb) {
require('child_process').exec('npm', function(err, stdout, stderr) {
if (err) return cb(err);
var m = /npm@[^ ]+ (.+)\n/i.exec(stdout);
if (!m)
return cb(new Error('Unable to find path in npm help message'));
cb(undefined, require(m[1]));
});
}
@mscdex
mscdex / foo.js
Last active August 29, 2015 13:59 — forked from OliverJAsh/foo.js
var request = require('request');
var zlib = require('zlib');
var websiteRequest = request('http://oliverjash.me/', {
headers: {
'Accept-Encoding': 'gzip,deflate'
}
});
// Request, `http.ClientRequest` – writable stream, emits a `response` event