Skip to content

Instantly share code, notes, and snippets.

// debounce function
//
// call like:
// debouncer(function() {
// console.log('do stuff');
// }, 1000);
function debouncer(c,to,t){
debouncer=function(c){
clearTimeout(t);
t=setTimeout(c,to);
@jstrellner
jstrellner / printindex.js
Last active November 29, 2015 04:59
Print the status of all index rebuilds.
db.currentOp().inprog.forEach(
function(op) {
if ((op.secs_running > 5) && (op.op == "query")) {
if ((op.msg !== undefined) && (op.msg.indexOf("%") != -1)) {
print(op.ns + " - " + op.msg + "\n");
}
}
}
)