Skip to content

Instantly share code, notes, and snippets.

View jcrugzz's full-sized avatar

Jarrett Cruger jcrugzz

View GitHub Profile
@jcrugzz
jcrugzz / godot-error-test.js
Last active December 21, 2015 12:09
Used for testing how the error propagation is handled in the internal streams
var godot = require('godot');
var server = godot.createServer({
type: 'tcp',
reactors: [
godot.reactor()
.console()
.map(function (data, callback) {
callback(new Error('WHOOPS GAIZ'));
}, { passThrough: true })
var http = require('http');
var Primus = require('primus');
var server = http.createServer(function (req, res) {
res.writeHead(500);
res.end('Not implemented\n');
});
var primus = new Primus(server, {transform: 'websockets', parser: 'JSON'});
var Socket = primus.Socket;
var http = require('http');
var ecstatic = require('ecstatic')(__dirname + '/public');
var bunyan = require('bunyan');
var log = bunyan.createLogger({
name: 'myapp',
stream: process.stdout,
level: 'info'
});
http.createServer(function (req, res) {
@jcrugzz
jcrugzz / server.js
Last active December 14, 2015 19:19
var http = require('http');
var ecstatic = require('ecstatic')(__dirname + '/public');
var server = http.createServer(ecstatic);
server.listen(3000);
var pkgcloud = require('pkgcloud');
client = pkgcloud.storage.createClient({
provider: 'rackspace',
username: 'nodejitsu',
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxx'
});
client.getContainers(function (err, container) {
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
nock('https://' + client.authUrl)
.post('/v1.1/auth', { "credentials": credentials })
.reply(200, helpers.loadFixture('rackspace/token.json'))
@jcrugzz
jcrugzz / pkgcloud error output
Created February 1, 2013 04:06
pkgcloud test error when offline
♢ pkgcloud/rackspace/databases/users │
/Users/jcrugzz/node.js/nodejitsu/pkgcloud/node_modules/nock/lib/request_overrider.js:139 │
if (interceptors.length < 1) { throw new Error("Nock: No match for HTTP re │
^
var hyperglue = require('hyperglue');
var html = require('./html/listElement');
module.exports = ChatList;
function ChatList (target) {
if(!(this instanceof ChatList)) return new ChatList(target);
this.target = target;
this.users = [];
@jcrugzz
jcrugzz / gist:4050675
Created November 10, 2012 10:42
nko server err
An error has occurred: {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"}