Skip to content

Instantly share code, notes, and snippets.

View jaspervalero's full-sized avatar

Jasper Valero jaspervalero

View GitHub Profile
@jaspervalero
jaspervalero / index.js
Created February 23, 2018 20:01 — forked from joerx/index.js
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();
# Manager README
As your manager, I look forward to getting to know you more through conversations and interactions. To give you a head start in knowing me I'd like to share my philoshopies and some information about myself.
#### I’m here to help you succeed, to provide the vision and context, and to represent you and the team across the company.
_DISCLAIMER – This document speaks on my behalf. It does not represent any other manager or team. It is a work in progress and I will iterate and adjust it based on experiences and feedback._
## Leadership Style
I'm a strong believer in [Servant Leadership](https://en.wikipedia.org/wiki/Servant_leadership). I serve you, not the other way around. I'm here to empower you to be your best and to help you grow.
@jaspervalero
jaspervalero / gist:a3dd4b16f9caf1d37dee
Created May 14, 2015 03:11
let No Overwrite Example
var gamertag = 'TheAwesomeOne0110', // Set default gamer tag
gamers = [{
gamertag: 'SomeGamer1',
email: '[email protected]'
}, {
gamertag: 'GrumpyTrollolol',
email: '[email protected]'
}];
console.log( 'Before:', gamertag ); // TheAwesomeOne0110
@jaspervalero
jaspervalero / gist:5d36a97002e6580c4343
Created May 14, 2015 02:59
var Overwrite Example
var gamertag = 'TheAwesomeOne0110', // Set default gamer tag
gamers = [{
gamertag: 'SomeGamer1',
email: '[email protected]'
}, {
gamertag: 'GrumpyTrollolol',
email: '[email protected]'
}];
console.log( 'Before:', gamertag ); // TheAwesomeOne0110
function greetUser( prefix, firstName, lastName ) {
var greeting = `Hello ${ prefix } ${ firstName } ${ lastName }!`;
return greeting;
}
console.log( greetUser( 'Mr.', 'Tony', 'Stark' ) ); // Hello Mr. Tony Stark!
var template = `You can type some text on the first line.
Then jump down to the next line.
You can even use tabs right inside the templates.`;
var template = `Simply use backticks to create a string template.`;
console.log( template );
@jaspervalero
jaspervalero / gist:c6517e6e88dbf33d5314
Last active August 29, 2015 14:17
ES5 Concatenating Strings For Use With Underscore.js Templates
var message = [
'I hope you can read my mind and understand how terrible',
'concatenating strings are in the current version of',
'JavaScript <%= prefix %> <%= firstName %> ',
'<%= lastName %> There nothing fun about it. Just a',
'whole lot of pain and yawn mode'
].join( '\n' );
console.log( message );
@jaspervalero
jaspervalero / gist:932c78fbbbede43d5082
Last active August 29, 2015 14:17
Multi-line String Concatenation In ES5
function messageUser( prefix, firstName, lastName ) {
var message = 'I hope you can read my mind and understand how terrible \
concatenating strings are in the current version of \
JavaScript ' + prefix + ' ' + firstName + ' \
' + lastName + '. There nothing fun about it. Just a \
whole lot of pain and yawn mode';
return message;
}
messageUser( 'Prof.', 'Charles', 'Xavier' );
@jaspervalero
jaspervalero / gist:71995c8e7b6666e7d448
Created March 25, 2015 04:28
String Concatenation In ES5
function greetUser( prefix, firstName, lastName ) {
var greeting = 'Hello ' + prefix + ' ' + firstName + ' ' + lastName + '!';
return greeting;
}
console.log( greetUser( 'Mr.', 'Tony', 'Stark' ) ); // Hello Mr. Tony Stark!