Skip to content

Instantly share code, notes, and snippets.

View rvagg's full-sized avatar

Rod Vagg rvagg

View GitHub Profile
@rvagg
rvagg / output
Created February 4, 2014 01:46 — forked from juliangruber/output
var Readable = require('stream').Readable;
var Writable = require('stream').Writable;
var readable = Readable();
readable._read = function(){
readable._t = setTimeout(function(){
readable.push(''+Date.now());
}, 100);
}
@rvagg
rvagg / gist:4663748
Last active December 11, 2015 21:38 — forked from andrepadez/gist:4663588
Location = {
referencia: {
type: Number,
unique: true
},
owner: {
type: Schema.Types.ObjectId,
ref: 'Owner'
},
accounts: [
function getTempImg(base64Image, filename, callback) {
var decodedImage = new Buffer(base64Image, 'base64');
var filename = 'cache/' + filename + '.jpg';
fs.writeFile(filename, decodedImage, function(err, data) {
console.log(data);
if (err) return callback(err);
callback(null, filename);
})
}
@rvagg
rvagg / ender.deferred.js
Created November 19, 2011 09:42 — forked from ded/ender.delay.js
ender deferred
!function ($) {
function deferred(exec) {
var mock = {}
, chain = []
, key
, $el = $(this)
, push = function (key) {
mock[key] = function () {
chain.push({ key: key, arguments: arguments })
return mock