Skip to content

Instantly share code, notes, and snippets.

Nicolas Chambrier naholyr

Block or report user

Report or block naholyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
naholyr /
Last active Aug 29, 2015
That one was nice

The bug

  The model is something like:
  Person: { name: String }
  Car: { name: String, driver: {type: Schema.Types.ObjectId, ref: 'Person'} }

// Somewhere we do this…
View random-data.js
var _ = require('lodash')
var utils = require('./mongo-utils')
var docs = require('./random-fixtures')(50000)
var db = utils.connect('mongodb://localhost/test')
View ninvoke.js
function wrap (fn, args, thisArg) {
return function () {
return Promise(function (resolve, reject) {
fn.apply(thisArg, (args || []).concat([function (err, res) {
if (err) reject(err)
else resolve(res)
naholyr /
Last active Aug 29, 2015
Mon ressenti sur les éditeurs


Pour du web (HTML/JS/CSS) + Node sous Ubuntu.

Actuellement : SublimeText, mais pas de visibilité sur le futur du projet (d'où recherche d'alternative).


naholyr / index.js
Created Sep 8, 2014
My usual nconf wrapper
View index.js
"use strict";
Save as config/index.js
Config files =
- config/config.json
- config/config.$NODE_ENV.json
- config/config.$NODE_ENV.$USER.json
naholyr / fixtures.js
Created Sep 8, 2014
My usual fixtures loader
View fixtures.js
// TODO comments (lol)
"use strict";
- Put your data in data.json
- Require from your test files `var fixtures = require('./path/to/fixtures')
- Load and clear with `before(fixtures.clear)`, `before(fixtures.load)`, `after(fixtures.clear)`
View Promise.defer.js
function defer () {
var _resolve, _reject;
var promise = new Promise(function (resolve, reject) {
_resolve = resolve;
_reject = reject;
return {
"promise": promise,
View pathsToTree.js
]), null, " "));
"e": null,
"a": {
naholyr /
Last active Aug 29, 2015
React trivial keys

See the discussion

Before (not good):

return <ul>{ => <li>{ p }</li>) }</ul>;
// Each child in an array should have a unique "key" prop. Check the render method of RoomSpace. See for more information.

Uglier (not sure better):

gnome-terminal --zoom=5 -e ~/bin/
You can’t perform that action at this time.