Skip to content

Instantly share code, notes, and snippets.

View panda-moe-zz's full-sized avatar

Sidhant Panda panda-moe-zz

View GitHub Profile
@joerx
joerx / index.js
Last active May 17, 2023 12:58
Mocking S3 in Node.js using Sinon
var Aws = require('aws-sdk');
var sinon = require('sinon');
// Only works for 'createBucket', 'update' and a few others since most API methods are generated dynamically
// upon instantiation. Very counterintuitive, thanks Amazon!
var createBucket = sinon.stub(Aws.S3.prototype, 'createBucket');
createBucket.yields(null, 'Me create bucket');
// For other methods, we can 'assign' the stubs to the proto, already defined function won't be overridden
var listBuckets = Aws.S3.prototype.listBuckets = sinon.stub();
@fijimunkii
fijimunkii / log-image.js
Created October 18, 2014 03:18
console.log a gif (from cssconf.eu)
console.log("%c+","font-size: 1px; padding: 180px 320px; line-height: 360px; background: url(http://i.imgur.com/kZfvHRV.gif); background-size: 640px 360px; color: transparent;");