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 collectionNames = db.getCollectionNames(), stats = []; | |
collectionNames.forEach(function (n) { stats.push(db[n].stats()); }); | |
stats = stats.sort(function(a, b) { return b['size'] - a['size']; }); | |
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); } |
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 loop(init, fnCondition, fnUpdate, fnRun, fnDone){ | |
var index = 0; | |
index = (init.constructor.name === "function")?init():init; | |
function next(){ | |
index = fnUpdate(index); | |
if(fnCondition(index)){ | |
setTimeout(function(){ | |
fnRun(index, next); | |
}, 0); | |
}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
module ActiveSupport | |
module Cache | |
class AtomicMemCacheStore < MemCacheStore | |
ALREADY_STORED = "STORED\r\n" | |
cattr_accessor :grace_period | |
@@grace_period = 3.minutes | |
def read(key, options = nil) | |
result = super | |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
#Selector de idioma | |
#dependencias: | |
# 1 - Rack locale del paquete Rack-contrib [1] | |
# USO: Se usa para detectar el idioma definido por el usuario en su browser ['HTTP_ACCEPT_LANGUAGE'] | |
# Esplicado aquí http://guides.rubyonrails.org/i18n.html#using-accept-language | |
# [1] http://github.com/rack/rack-contrib | |
# 2 - Routing-filter [1] | |
# USO: Establecer el locale en las URLs ej.: www.mysite.com/es/foo/bar | |
# NOTA: Si tambien quieres traducir las URL's usa la gema de Raul Murciano Translate_routes [2] (De momento sin cobertura para Rails3) |