This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var stream = fs.createWriteStream('test_log.log', {flags: 'w+'}) | |
var buf = new Buffer('im just a little string, log me out and watch mem grow\n', 'utf8') | |
var start = Date.now() | |
function log() { | |
for(var i = 0; i < 1000; i++) { | |
stream.write(buf) | |
} | |
console.log(process.memoryUsage()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var test = require('tap').test; | |
var tracer = require('tracing') | |
test("async listener lifecycle", function (t) { | |
t.plan(1); | |
var count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 357ac14276b19fd760a9c3441a81ba2469e4e42a Mon Sep 17 00:00:00 2001 | |
From: Michael Hayes <[email protected]> | |
Date: Fri, 10 Oct 2014 13:49:15 -0700 | |
Subject: [PATCH] wip | |
--- | |
lib/instrumentation/express.js | 71 ++++++++++++++++++++++++++++++++++-------- | |
1 file changed, 58 insertions(+), 13 deletions(-) | |
diff --git a/lib/instrumentation/express.js b/lib/instrumentation/express.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express(); | |
var sub = express.Router() | |
var sub2 = express.Router() | |
sub2.get('/c', function(req, res, next, base) { | |
res.send('sub test!!') | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TransfromStream = require('stream').Transform | |
module.exports = Parser | |
function Parser(row, col) { | |
TransfromStream.call(this) | |
this._writableState.objectMode = false | |
this._readableState.objectMode = true | |
this.row_delim = row || '\r\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function upload_file(file) { | |
var fd = new FormData | |
, self = this | |
fd.append('file', file) | |
var xhr = request.post(url, {}, fd, function(err, response, headers) { | |
if(err) { | |
// non 200 resonse will be an error | |
// handle error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = Batch | |
function Batch(sync) { | |
if(!(this instanceof Batch)) { | |
return new Batch(sync) | |
} | |
this.jobs = [] | |
this.sync = sync | |
this.frame = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_commas(args, change) { | |
return function(val) { | |
var regex = /(\d+)(\d{3})/ | |
val = val.toString() | |
while(regex.test(val)) { | |
val = val.replace(/(\d+)(\d{3})/, '$1,$2') | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var format = require('util').format | |
, ldap = require('ldapjs') | |
, fs = require('fs') | |
module.exports = setup | |
function setup(unpm) { | |
var base_options = { | |
url: unpm.config.ldap.uri | |
, tlsOptions: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tape = require('tape') | |
module.exports = setup | |
function setup(up, down, run) { | |
return function add_test(name, fn) { | |
var test_state = {} | |
var test = tape(name, function(t) { | |
test_state = up ? up(test_state) : test_state |