Skip to content

Instantly share code, notes, and snippets.

View mbrainiac's full-sized avatar

Nguyen Tien Dzung mbrainiac

View GitHub Profile
@mbrainiac
mbrainiac / after_res_hooks.js
Created October 13, 2016 06:47 — forked from pasupulaphani/after_res_hooks.js
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups
@mbrainiac
mbrainiac / TileLayer.Common.js
Created June 15, 2016 06:22 — forked from mourner/TileLayer.Common.js
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {