Skip to content

Instantly share code, notes, and snippets.

💚
love

stagas stagas

💚
love
Block or report user

Report or block stagas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View console-output.txt
Potentially unhandled rejection [3] TypeError: Error loading "index" at http://localhost:8080/index.js
Error loading "index" from "test.js" at http://localhost:8080/test/test.js
Cannot read property 'name' of null
at l (http://localhost:8080/test/vendor/es6-module-loader.js:7:16462)
at j (http://localhost:8080/test/vendor/es6-module-loader.js:7:16047)
at k (http://localhost:8080/test/vendor/es6-module-loader.js:7:16389)
at http://localhost:8080/test/vendor/es6-module-loader.js:7:14764
at O (http://localhost:8080/test/vendor/es6-module-loader.js:7:7453)
at K (http://localhost:8080/test/vendor/es6-module-loader.js:7:7085)
at y.7.y.when (http://localhost:8080/test/vendor/es6-module-loader.js:7:10759)
@stagas
stagas / reexport.js
Created Jan 13, 2013
example passing deps around with exports.
View reexport.js
// common.js
exports.app = require('./app')
exports.db = require('./db')
// app.js
var common = require('./common')
var db = common.db
var app = module.exports = express()
View fork.js
var n = +(process.argv[2] || 10000)
var cp = require('child_process')
var child = cp.fork(__dirname + '/worker.js')
console.log('trying', n, 'messages')
var total = n
child.on('message', function () {
if (!--total) console.log('completed %d roundtrips', n - total)
@stagas
stagas / a.js
Created Mar 17, 2012
test for global leak
View a.js
module.exports = foo = 'hello'
@stagas
stagas / protocol.js
Created Dec 31, 2011 — forked from jfhbrook/protocol.js
Thinking about a human-readable multi-line pubsub api for irc bots...
View protocol.js
var EventEmitter = require('events').EventEmitter,
util = require('util');
// TODO:
// * tags (BEGIN somehashhere\nsomehashhere data)
// * line numbers (begin somehash\nsomehash:12 data)
var Buffer = exports.Buffer = function (o) {
o = o || {};
@stagas
stagas / nextTick-for-browser.js
Created Sep 18, 2011
nextTick implementation for the browser
View nextTick-for-browser.js
// nextTick - by stagas / public domain
var nextTick = (function () {
var queue = [];
var dirty = false;
var fn;
var hasPostMessage = !!window.postMessage;
var messageName = 'nexttick';
var trigger = (function () {
return hasPostMessage
? function trigger () {
@stagas
stagas / memoizenchaos.js
Created Aug 23, 2011
recursive memoize
View memoizenchaos.js
var express = require('express')
, memoize = require('memoize')
, cache = require('chaos')('cache')
, Beatport = require('beatport')
memoize.set('debug', true)
var bp = memoize('beatport-mem', memoize('beatport', Beatport({ perPage: 10, sortBy: 'releaseDate desc' }), {
expire: 1000 * 60 * 60 * 24
, store: cache
View prompt.js
var readline = require('readline')
, rl = readline.createInterface(process.stdin, process.stdout)
function prompt (str, cb) {
rl.setPrompt(str)
rl.prompt()
rl.once('line', cb)
}
prompt('> ', function (str) {
@stagas
stagas / test-methods.js
Created Jun 27, 2011
node-http-proxy methods not working
View test-methods.js
var http = require('http')
, httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
//
// Put your custom server logic here
//
proxy.proxyRequest(req, res, {
host: 'localhost',
port: 9000
@stagas
stagas / LICENSE.txt
Created May 26, 2011 — forked from 140bytes/LICENSE.txt
Padding for Strings and Numbers
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 George Stagas https://github.com/stagas
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
You can’t perform that action at this time.