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
// This event emitter emits events, but reserves the right to publish events to | |
// for its creator. It uses a WeakMap for true encapsulation. | |
const eesToEventMaps = new WeakMap(); | |
export default class EventEmitter { | |
constructor(publisher) { | |
const eventMap = Object.create(null); | |
eesToEventMaps.set(this, eventMap); |
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
const { exec } = require('./helpers') | |
const changedFile = (filename, partial) => exec( | |
`git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD`, | |
`Something went wrong reading last git-pulled files list.`, | |
true | |
).then((stdout) => stdout.split('\n') | |
.some((name) => { | |
let match | |
if (partial) { |
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
class Comp extends React.Component { | |
constructor(props) { | |
super(props) | |
this.onMouseDown = this.onMouseDown.bind(this) | |
this.onMouseMove = this.onMouseMove.bind(this) | |
this.onMouseUp = this.onMouseUp.bind(this) | |
this.state = { onMouseMove: null, onMouseUp: null } | |
} |
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
import React from 'react' | |
const provideContext = (contextKey, contextType) => ( | |
React.createClass({ | |
childContextTypes: { | |
[contextKey]: contextType | |
}, | |
getChildContext() { | |
const { children, ...props } = this.props |
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
#/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# forked by Gianluca Guarini | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep -E --quiet "$1" && eval "$2" | |
} |
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
// User.js | |
const UPDATE_USER = 'UPDATE_USER' | |
const defaultUser = { | |
displayName: null | |
} | |
function userReducer(state = defaultUser, action) { | |
switch (action.type) { |
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
function compose (...fns) { | |
return (...args) => | |
fns.reduceRight((child, fn) => | |
fn.apply(null, child ? [child] : args), null | |
) | |
} | |
const b = i => <b>{i}</b> | |
const i = i => <i>{i}</i> | |
const u = i => <u>{i}</u> |
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
'use strict'; | |
/** | |
* Module dependencies. | |
*/ | |
const Hoek = require('hoek'); | |
const Limiter = require('ratelimiter'); | |
const RedisClient = require('../utils/redis'); | |
const ReplyUtil = require('../utils/reply'); |
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
// see: https://github.com/rackt/redux/issues/1367#issuecomment-180073370 | |
import reducer, { increment, decrement } from 'redux-counter' | |
class App extends Component { | |
constructor() { | |
super() | |
this.state = reducer(undefined, {}) | |
} |