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 myObject() { | |
function initialize() { | |
//do something | |
someAsynchrounosFunction( function (err, data) { | |
this.emit( 'init' ); | |
} ); | |
} | |
initialize(); |
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 = [] | |
,number = 5000 | |
,numberElements = 130 | |
,numberQueries = 15; | |
for( var i = 0; i < number; i++ ) { | |
data[ i ] = {}; | |
for( var x = 0; x < numberElements; x++ ) { |
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 cluster = require( 'cluster' ) | |
,http = require( 'http' ); | |
if ( cluster.isMaster ) { | |
for (var i = 0; i < 8; i++) { | |
var worker = cluster.fork(); | |
worker.on( 'message', function() { | |
console.log( Math.random() ); | |
} ); |
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 EE = require( 'events').EventEmitter; | |
var utils = require( 'util' ); | |
function MyEmitter() { | |
EE.call( this ); | |
var that = this; | |
this.doit = function() { | |
//doing something..... |
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 dgram = require('dgram'); | |
var cluster = require('cluster'); | |
var http = require('http'); | |
var socket = dgram.createSocket("udp4"); | |
if (cluster.isMaster) { | |
for (var i = 0; i < 4; i++) { | |
cluster.fork(); | |
} |
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 server; | |
var app = express(); | |
fooHandler.on('initialized', function(error) { | |
server = app.listen(configuration.port); | |
}); | |
process.on('uncaughtexception', function (error) { | |
//throws if the server is not acutally running | |
server.close(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
futex(0x7fad86ffd9d0, FUTEX_WAIT, 14380, NULL | |
(gdb) bt | |
#0 0x0000003322009080 in pthread_join () from /lib64/libpthread.so.0 | |
#1 0x00000000006d431e in uv_thread_join () | |
#2 0x00000000005868ea in ?? () | |
#3 0x000000332180f77e in _dl_fini () from /lib64/ld-linux-x86-64.so.2 | |
#4 0x0000003321c39931 in __run_exit_handlers () from /lib64/libc.so.6 | |
#5 0x0000003321c399b5 in exit () from /lib64/libc.so.6 | |
#6 0x000000000058cbc7 in node::Exit(v8::Arguments const&) () |
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 cp = require('child_process'); | |
var c = cp.execFile("/bin/false"); | |
c.on('exit', function() { | |
console.log("got exit"); | |
}); |
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
describe('sample test request', function () { | |
var response, body; | |
before(function (done) { | |
var options = { | |
url: BASE_URL + 'outputDebugInfo', | |
headers: { | |
'foo': 'bar' | |
} | |
}; |
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 spawn = require('child_process').spawn; | |
var path = require('path'); | |
var pathToMockServer = path.join(__dirname, '../../tests/mockServer/server'); | |
var mockServerProcess; | |
before(function (done) { | |
console.error('\nStarting mock server...'); | |
mockServerProcess = spawn('node', [pathToMockServer]); |
OlderNewer