Skip to content

Instantly share code, notes, and snippets.

@ronkot
ronkot / README.md
Created June 8, 2018 07:56 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@ronkot
ronkot / rastas-promise.js
Last active July 25, 2023 05:42
Simple Promise implementation
const PENDING = 1;
const RESOLVED = 2;
const REJECTED = 3;
const callLater = (fn) => setTimeout(fn, 0);
class Promise {
constructor(initPromiseFn) {
this._state = PENDING;
this._value = undefined;
@ronkot
ronkot / .babelrc
Last active August 1, 2016 12:36
babel-plugin-rewire problem
{
"presets": ["es2015", "es2015-node4", "async-to-bluebird"],
"env": {
"test": {
"plugins": ["babel-plugin-rewire"]
}
}
}
@ronkot
ronkot / post-commit
Last active August 29, 2015 14:08 — forked from mashihua/post-commit
#!/usr/bin/env node
//please requist your app token from
//https://trello.com/1/connect?key=yourkey&name=git-hook&expiration=never&response_type=token&scope=read,write
var key = "your key";
var token = "your token";
//https://trello.com/board/-/4e9003324a517dad44465056
var board_id = "4e9003324a517dad44465056";
var Trello = require("node-trello");