Skip to content

Instantly share code, notes, and snippets.

@srlowe
srlowe / index.js
Created March 2, 2018 12:16
Differences error handling behaviour between mongoose versions 4 & 5
//This is intended to illustrate differences error handling behaviour
//between mongoose versions 4 & 5
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/mongoosetest', { useMongoClient: true });
var AnimalSchema = new mongoose.Schema({
name: String
});
@srlowe
srlowe / MicroTxnAuthorizationListener_snippet.cc
Last active November 9, 2015 14:03
Greenworks MicroTxnAuthorizationListener
// In `greenworks_api.cc`:
static MicroTxnAuthorizationListener *microTxnAuthorizationListener;
//...
NAN_METHOD(SetMicroTxnAuthorizationResponseCallback) {
Nan::HandleScope scope;
if (info.Length() < 1 || !info[0]->IsFunction()) {
THROW_BAD_ARGS("Bad arguments - [SetMicroTxnAuthorizationResponseCallback]");