Skip to content

Instantly share code, notes, and snippets.

Avatar

Rod Vagg rvagg

View GitHub Profile
View 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);
}
View gist:4663748
Location = {
referencia: {
type: Number,
unique: true
},
owner: {
type: Schema.Types.ObjectId,
ref: 'Owner'
},
accounts: [
View gist:3523962
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 Nov 19, 2011 — forked from ded/ender.delay.js
ender deferred
View ender.deferred.js
!function ($) {
function deferred(exec) {
var mock = {}
, chain = []
, key
, $el = $(this)
, push = function (key) {
mock[key] = function () {
chain.push({ key: key, arguments: arguments })
return mock
You can’t perform that action at this time.