This file contains 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
this.inject = function(fn) { | |
return function() { | |
var inject = annotate(fn); | |
var callArgs = []; | |
var args = Array.prototype.slice.call(arguments, 0); | |
inject.forEach(function(arg) { | |
if (arg.slice(0,1) === "$") { | |
callArgs.push(use[arg]); | |
} else { |
This file contains 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'), | |
nconf = require('nconf'); | |
function FileWriter(logger, conf, cb) { | |
"use strict"; | |
var currentFile = conf.get("logger:folder") + "/" + process.pid + ".log", | |
writeStream = fs.createWriteStream(currentFile), | |
rotate = 0, | |
maxSize = 1024 * 1024 * 1024, |
This file contains 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 sync = require('synchronize'); | |
function executeQuery(qryString, cb) { | |
setTimeout(function() { | |
cb(null, qryString); | |
}, 1500); | |
} | |
sync.fiber(function() { | |
var query = function(qryString) { |
This file contains 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 obj = {}, | |
needed = 1024*1024; | |
for(i = 0; i < needed; i++) { | |
obj[i] = "avx"; | |
} | |
function forLoopTest() { | |
var start = process.hrtime(); |
This file contains 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
process.stdin.resume(); | |
process.stdin.on('data', function stdinPass(data) { | |
process.stdin.removeListener('data', stdinPass); | |
process.stdin.pause(); | |
var pass = data.toString("utf8").trim(); | |
var m = crypto.createHash('md5'); | |
m.update(pass, "utf8"); | |
var key = m.digest('hex'); |
This file contains 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
process.stdin.resume(); | |
process.stdin.on("data", function(data) { | |
process.stdin.pause(); | |
var pass = data.toString("utf8").trim(); | |
var m = crypto.createHash('md5'); | |
m.update(pass, "utf8"); | |
var key = m.digest('hex'); | |
m = crypto.createHash('md5'); |
This file contains 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 dependencies. | |
*/ | |
var util = require('util'), | |
OAuth2Strategy = require('passport-oauth').OAuth2Strategy, | |
InternalOAuthError = require('passport-oauth').InternalOAuthError; | |
function Strategy(options, verify) { | |
options = options || {}; | |
options.authorizationURL = options.authorizationURL || 'https://stackexchange.com/oauth'; |
This file contains 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 step1() { | |
console.log("Step 1"); | |
setTimeout(function () { | |
step2(); | |
}, 2000); | |
} | |
function step2() { | |
console.log("Step 2"); | |
setTimeout(function () { |
This file contains 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 data = 'F somekeyforyourservero {"Topic":"test","Text":"test","SenderUserId":3,"Addressers":[],"DateSent":"2013-02-16T11:10:26.953174Z","Id":0}'; | |
data = data.replace(/^\s*F\s*somekeyforyourservero\s*/, ''); | |
console.log(data); |
This file contains 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 buffer = new Buffer(150000), | |
buffer.fill("0"), | |
events = require('events'), | |
util = require('util'); | |
function BufferStream(buffer) { | |
events.EventEmitter.call(this); | |
this.readable = true; | |
this.writeable = false; |