Skip to content

Instantly share code, notes, and snippets.

View serhalp's full-sized avatar

Philippe Serhal serhalp

View GitHub Profile
@serhalp
serhalp / bar.js
Created June 14, 2017 23:55
Repro for mongoose Model.populate throwing uncaught synchronous MissingSchemaError.
const mongoose = require('mongoose');
module.exports = mongoose.model('Bar', new mongoose.Schema({
baz: String,
}));
@serhalp
serhalp / mongoose-post-save.js
Created June 13, 2017 00:09
mongoose post-save timing
const mongoose = require('mongoose');
mongoose.Promise = Promise;
mongoose.connect('mongodb://localhost/test_mongoose_postsave')
.then(testPostSave)
.then(() => mongoose.disconnect());
const log = console.log;
function testPostSave () {

Keybase proof

I hereby claim:

  • I am serhalp on github.
  • I am serhalp (https://keybase.io/serhalp) on keybase.
  • I have a public key ASBx2GfLkVl0SFcfRnWIIIibhaIuQgq3Rhd6hf8LYhJbLgo

To claim this, I am signing this object:

@serhalp
serhalp / prepare-commit-msg
Last active March 26, 2018 19:20
Pre-populate Git commit message with current branch's Pivotal Tracker story ID
#!/bin/sh
TMP=`git rev-parse --abbrev-ref HEAD | grep -o '[-_]\d\+$'`
STORY_ID=${TMP:1}
if [[ ! -z $STORY_ID ]]
then
ORIG_MSG_FILE="$1"
ORIG_MSG=`cat $1`
(echo "[#$STORY_ID]") > "$ORIG_MSG_FILE"