Skip to content

Instantly share code, notes, and snippets.

View mrutid's full-sized avatar

Marcos Reyes mrutid

  • Telefónica España
View GitHub Profile
@mrutid
mrutid / gist:7447424
Created November 13, 2013 11:16
Hace lo que tiene que hacer, aunque no me gusta como acumulo.Prefiero un array de cadenas. Pasan los test de checkeo pero he roto algo... que no deberia tener que ver....
/*
for (var field in fields) {
if (typeof body[fields[field]] == 'undefined') {
callback({
code: "FIELDS_MISSING",
field: fields[field]
});
return;
var sio = require('socket.io-client');
var request = require('request');
var async = require('async');
var config = { ratio : 1000,
urlAbuela : 'http://localhost:3005/abuela',
urlCasa : 'http://localhost:3005/casa',
socketHost: 'localhost',
socketPort: '3004'
};
@mrutid
mrutid / gist:4284275
Created December 14, 2012 10:14
PopBox - Pops data from N queues (not just H and L) Custom DB clustering will not apply (redis clustering should be used instead)
/**
* Created with JetBrains WebStorm.
* User: mru
* Date: 24/10/12
* Time: 09:12
* To change this template use File | Settings | File Templates.
*/
var redisModule = require('redis');
var rc = redisModule.createClient(6379, 'localhost');
@mrutid
mrutid / gist:4284268
Created December 14, 2012 10:13
PopBox - Pops data from N queues (not just H and L) Custom DB clustering will not apply (redis clustering should be used instead)
/**
* Created with JetBrains WebStorm.
* User: mru
* Date: 24/10/12
* Time: 09:12
* To change this template use File | Settings | File Templates.
*/
var redisModule = require('redis');
var rc = redisModule.createClient(6379, 'localhost');
var async = require('async');
var fs = require('fs');
var initArr = [];
exports.init = function(directory, context, callback){
var files = fs.readdirSync(directory);
console.log('Files Readed:' + files);
files.forEach(function(element) {
var module = require(directory + element);
initArr.push(function(cb) {
@mrutid
mrutid / loader.js
Created May 14, 2012 08:32
Dynamic module loading (async)
var async = require('async');
var fs = require('fs');
var initArr = [];
var options = 'EmitterFoo';
var files = fs.readdirSync("./listeners/"); //better sync
console.log('Files Readed:' + files);
files.forEach(function(element) {