View get-latest-node-version.sh
nvm ls-remote | tail -1 | sed -r 's/.*v(\S+).*/\1/'
View delete_all_branches_except.fish
git branch -D (git branch | grep -E -v 'develop|master' | tr -ds '\n' ' ' | sed 's/^[ \t]*//')
View bookshelf-transaction-coroutine.js
var Promise = require('bluebird');
Bookshelf.transaction(Promise.coroutine(function*(t) {
const library = yield Library.forge({name: 'Old Books'}).save(null, {transacting: t});
return yield Promise.map(
[
{ title: 'Canterbury Tales' },
{ title: 'Moby Dick' },
{ title: 'Hamlet' }
],
View apps.md
  • Bartender 2
  • Brave
  • Caret
  • Gitify
  • Gitter
  • Hacker Menu
  • Lighting
  • Paw
  • Screenhero
  • Spotify Bluetooth Headset Listener
View promise-series-migration-example.js
const Promise = require('bluebird');
Promise.series = (promiseArr) => Promise.each(promiseArr, (result) => result);
exports.up = function(knex) {
return Promise.series([
knex.schema.renameTable('tomatoes', 'potatoes'),
knex.schema.table('potatoes', (table) => table.string('name'))
]);
};
View promise-series-broken-implementation.js
const Promise = require('bluebird');
Promise.series = (promiseArr) => Promise.each(promiseArr, (result) => result);
View knex-migration-promise-example.js
const Promise = require('bluebird');
exports.up = function(knex) {
return Promise.all([
knex.schema.renameTable('tomatoes', 'potatoes'),
knex.schema.table('potatoes', (table) => table.string('name'))
]);
};
View request-file-coroutine.js
const requestFromLinkInFile = Promise.coroutine(function*() {
const url = yield fs.readFile('link.txt');
const response = yield request.get(url);
return response.body ? response.body : 'No body returned from request.';
})();
View coroutine-test-example.js
describe('GET potatoes', function() {
it('returns JSON with only authenticated robot\'s potatoes', function*() {
const glados = yield factory.create('robot');
const gladosPotatoes = [
yield factory.create('potato', { ownerId: glados.id });
yield factory.create('potato', { ownerId: glados.id });
];
const wheatley = yield factory.create('robot');
const wheatleyPotato =
View promise-test-example.js
describe('GET potatoes', function() {
it('returns JSON with only authenticated robot\'s potatoes', function(done) {
const objs = {};
const createGlados = function() {
return factory.create('robot').then(function(robot) {
objs.glados = robot;
return robot;
});
};