This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Given an image URL or path, crop and resize it to be exactly a specific size. | |
* Crops centrally to force enforce the correct aspect ratio, and then resizes as per normal. | |
* Depends on the `when` and `gm` NPM modules. | |
* Returns a promise that resolves with an image buffer in a .PNG format. | |
*/ | |
var when = require('when'); | |
var gm = require('gm'); | |
var im = gm.subClass({ imageMagick: true }); // use `im` in place of `gm` for heroku compatibility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/test'); | |
var db = mongoose.connection; | |
db.on('error', function() { | |
return console.error.bind(console, 'connection error: '); | |
}); | |