Skip to content

Instantly share code, notes, and snippets.

View assertnotnull's full-sized avatar
🏠
Working from home

Patrice Gauthier assertnotnull

🏠
Working from home
View GitHub Profile
@assertnotnull
assertnotnull / socketlogger.js
Created June 11, 2015 16:14
somewhat reusable socket logger
//somewhat reusable module socketlogger - it requires the usage of global.socket
//so it's not passed to every log function.
function SocketLogger() {}
var getLogger = function(categoryName) {
SocketLogger.prototype = log4js.getLogger(categoryName);
['Trace','Debug','Info','Warn','Error','Fatal', 'Mark'].forEach(
function (levelString) {
var level = log4js.levels.toLevel(levelString);
@assertnotnull
assertnotnull / concurrent.js
Last active August 29, 2015 14:20
Q promises concurrency test
var Q = require('q');
var debug = require('debug')('test');
var func1 = function() {
return Q.promise(function(resolve, reject) {
setTimeout(function() {
debug('concurrent func1?');
resolve(1);
}, 4000);
});
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}