Skip to content

Instantly share code, notes, and snippets.

View pjanuario's full-sized avatar

Pedro Januário pjanuario

View GitHub Profile
@pjanuario
pjanuario / LoggerAirbrakePluginSample
Created August 5, 2014 15:52
LoggerAirbrakePlugin sample
var Logger = require('logger-facade-nodejs');
var LoggerAirbrakePlugin = require('logger-facade-airbrake-plugin');
console.log("Start sample of Async error Log...");
var config = {
//api key, default (null)
apiKey: "apikey",
// host, default (null)
host: "api.airbrake.io",
@pjanuario
pjanuario / logger-facade-console-plugin-nodejs-sample.js
Last active February 5, 2016 09:31
This gist is logger facade console plugin nodejs usage sample
var Logger = require('logger-facade-nodejs');
var LoggerConsolePlugin = require('logger-facade-console-plugin-nodejs');
// this is the default config
var config = {
level: 'debug',
timeFormat: 'YYYY-MM-DD HH:mm:ss',
messageFormat: '%time | %logger::%level - %msg'
};
@pjanuario
pjanuario / js-object-comparer.js
Created March 24, 2014 16:26
Compare javascript objects and output property name and value of different ones. Usefull for unit testing, property detection.
var compareKeys = function(obj, obj2){
for(var key in obj){
var _obj = obj[key];
var _obj2 = obj2[key];
if(!_obj){
if(_obj2){
console.log("%s: %s => %s",
key, _obj, _obj2);
@pjanuario
pjanuario / analyze.rb
Last active December 31, 2015 15:49 — forked from ldmosquera/analyze.rb
Analyze redis keys patterns this was forked from previous script and updated
#!/usr/bin/env ruby
#usage: analyze.rb REDIS_PORT
#produces CSV with stats by key pattern
#ex: [foo:bar:123, foo:bar:234] -> foo:bar:ID
# development:hari:contest/log_entry#8a0b7edae8b965c9:log:in:contest
# development:hari:notification#24d1d025654c71e7:components
# development:rex:event#11570:traits
require 'rubygems'
@pjanuario
pjanuario / redis_keys_migration
Last active December 28, 2015 10:49
This script migrates redis keys namespaces
require 'redis'
module RedisMigrator
def self.run
from = "production:"
to = "development:"
start = Time.now