Skip to content

Instantly share code, notes, and snippets.

@AvianFlu
AvianFlu / gist:992044
Created May 25, 2011 21:33
First Batch of rate data from #Node.js. Yes, I was a noob and put /n on the first two lines instead of \n.
Started: 25 13:29/nStopped: 25 14:29/nMinute: 0 Messages: 2
Minute: 1 Messages: 4
Minute: 2 Messages: 3
Minute: 3 Messages: 4
Minute: 4 Messages: 2
Minute: 5 Messages: 2
Minute: 6 Messages: 1
Minute: 7 Messages: 0
Minute: 8 Messages: 0
Minute: 9 Messages: 0
@AvianFlu
AvianFlu / gist:992209
Created May 25, 2011 23:06
81 minutes of #Node.js messages per minute
Started: 25 14:36
Stopped: 25 15:57
Minute: 0 Messages: 9
Minute: 1 Messages: 9
Minute: 2 Messages: 19
Minute: 3 Messages: 16
Minute: 4 Messages: 10
Minute: 5 Messages: 5
Minute: 6 Messages: 0
Minute: 7 Messages: 0
function AuthFailed(msg){
this.name = 'AuthFailed';
this.message = msg;
Error.call(this, msg);
Error.captureStackTrace(this, arguments.callee);
}
AuthFailed.prototype.__proto__ = Error.prototype;
var err = new AuthFailed('test error');
@AvianFlu
AvianFlu / gist:1126545
Created August 4, 2011 23:14
NPM error, two installs stopped simultaneously with the same error
ERR! SyntaxError: Unexpected token ILLEGAL
ERR! Internal routing error
ERR!
ERR! Sorry, we cannot connect to the intended server.
ERR!
ERR! We have just been notified of this problem. We will correct it as soon as possible.
ERR!
ERR! Feel free to contact us if you have any questions: support@iriscouch.com
ERR! at Object.parse (native)
ERR! at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:163:25)
@AvianFlu
AvianFlu / gist:1131154
Created August 8, 2011 03:23
How to not nest your callbacks.
var fs = require('fs'),
total = '';
function readAndConcat(files) {
files.forEach(gotFile);
}
function gotFile(file) {
fs.readFile(file, useData);
}
@AvianFlu
AvianFlu / gist:1138356
Created August 10, 2011 21:44
Am I still seeing the same old bug? Jitsu v0.4.0 via Morbo just now
info: Executing command deploy
info: Authenticated as aviantestertwo
info: Analyzing your application dependencies in server.js
warn: No application exists for space-tweet
info: Analyzing your application dependencies in server.js
var Thing = module.exports = function (options) {
for (var o in options) {
this[o] = options[o];
}
}
Thing.prototype.method = function (arg) {
var self = this;
@AvianFlu
AvianFlu / gist:1142699
Created August 12, 2011 18:54
A routing table and a forward in the same proxy setup
var http = require('http'),
httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
var options = {};
if (req.headers.host === 'google.myserver.com') {
req.headers.host = 'google.com';
options.host = 'google.com';
options.port = 80;
console.log(req.headers);
@AvianFlu
AvianFlu / bnc.js
Created August 14, 2011 02:45
The littlest BNC that could
//
// The best BNC ever, (c) 2011 AvianFlu
// Released under MIT License
//
var net = require('net');
var bncServer = net.createServer(onConnect);
bncServer.listen(6969, process.argv[2] || 'localhost');
@AvianFlu
AvianFlu / irc-config.json
Created August 30, 2011 02:33
Sample kohai configs
{
"server": "irc.freenode.net",
"nick": "awesomebot",
"password": "",
"channels": ["#nodetestsu", "#nodebombrange", "#kohai"],
"showErrors": "true",
"userName": "hookio",
"realName": "Hook.io IRC Client",
"promptMsg": "Hook.io-IRC",
"promptDelim": ">",