This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router('/foo', async function(ctx) { | |
ctx.unsubscribe = await doStuff() | |
}) | |
router('/foo', async function(ctx) { | |
ctx.unsubscribeMore = await doMoreStuff() | |
}) | |
router.after('/foo', async function(ctx) { | |
await doMoreStuff(ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import React from 'react' | |
type QuoteProps = { | |
message: string, | |
quote: string, | |
name: string, | |
photoUrl: string, | |
photoAlt: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES7 | |
getPlayers() | |
::map(x => x.character()) | |
// ES6 | |
let _val | |
_val = getPlayers() | |
_val = map(_val, x => x.character()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Confused? See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions | |
function flatten(previous, current) { | |
return previous.concat(current) | |
} | |
var productImages = [ | |
for(section of CatalogSections) [ | |
for(placement of section.ProductPlacements) [ | |
for(item of placement.ProductPlacementItems) [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modified from: https://gist.github.com/rpflorence/1f72da0cd9e507ebec29 | |
var React = require('react/addons') | |
var merge = require('lodash-node/modern/objects/assign') | |
function makeStubbedElement(Component, props, contextStubs) { | |
var TestWrapper = React.createClass({ | |
displayName: 'StubbedElement', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install jiff --save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('as a super administrator', function() { | |
it('create a session', async function(done) { | |
var { | |
user, | |
password | |
} = await fixtures(['User'], { | |
user: { superAdministrator: true } | |
}) | |
request(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.ghx-columns .ghx-column').each(function() { | |
var columnPoints = 0; | |
var dataColumnId = $(this).data('column-id'); | |
$(this).find('.aui-badge').each(function() { | |
columnPoints += parseInt($(this).text(),10); || 0 | |
}); | |
var h2 = $('#ghx-column-headers .ghx-column[data-id=' + dataColumnId + '] h2'); | |
var span = h2.find('span'); | |
if(!span.length) { | |
span = $('<span class="badge" style="margin-left: 6px;"></span>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias superpull='git checkout master; git pull; for branch in $(git branch --no-merged); do git rebase -q master $branch; done; git checkout master && for branch in $(git branch --merged | grep -v master); do git branch -d $branch; done; echo "Done."' | |
or | |
[alias] | |
sp = "!bash -c 'git checkout master; git pull; for branch in $(git branch --no-merged); do git rebase -q master $branch; done; git checkout master && for branch in $(git branch --merged | grep -v master); do git branch -d $branch; done; echo \"Done.\"'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Predictable | |
Disposable | |
Unidirectionality | |
Discoverable / greppable | |
Smaller mental maps | |
Single source of truth | |
vs | |
Cascading and concatenation |