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
export const RESET_FORM = 'RESET_FORM' | |
export const SET_FORM_VALUE = 'SET_FORM_VALUE' | |
export const setValue = (id, name, value) => ({ type: SET_FORM_VALUE, id, name, value }) | |
export const reset = (id, name, value) => ({ type: SET_FORM_VALUE, id }) | |
const withForm = (stateName, id = stateName, resetOnUmount = true) => { | |
const composers = [ | |
connect(state => { | |
form: state.forms[id], |
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 { reduce, set } from 'lodash' | |
export default function expandObject(object) { | |
return reduce(object, (expanded, value, key) => set(expanded, key, value), {}) | |
} |
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 firebase from 'firebase' | |
import { filter, map } from 'lodash' | |
import { makeExecutableSchema } from 'graphql-tools' | |
firebase.initializeApp({ | |
databaseURL: 'https://grafire-b1b6e.firebaseio.com', | |
}) | |
const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() }) | |
const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value })) |
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 express from 'express' | |
import path from 'path' | |
import mime from 'mime' | |
const app = express() | |
app.use(express.static(buildPath)) | |
app.use((req, res, next) => { | |
if (req.method === 'GET' && mime.lookup(req.path) === mime.default_type) { | |
res.sendFile('index.html') | |
return |
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 startTime = Date.now() | |
const start = async (attempt, { retries = 3, interval = 250 }) => { | |
for (let tries = 0, delay = interval; tries < retries; tries++, delay *= 2) { | |
console.log('Waiting', delay, Date.now() - startTime) | |
await attempt() | |
console.log('Retrying!') | |
} | |
console.log('Done trying') |
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
git for-each-ref --no-merged master --shell refs/heads/ --format='git merge-tree `git merge-base %(refname) master` master %(refname)'|s |
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, { Component, PropTypes } from 'react' | |
import useSheet from 'react-jss' | |
class Frontpage extends Component { | |
static propTypes = { | |
sheet: PropTypes.object.isRequired, | |
} | |
render() { | |
const { classes } = this.props.sheet |
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' | |
export default () => ( | |
<div> | |
My Component | |
</div> | |
) |
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
/* eslint-disable no-use-before-define */ | |
import { | |
GraphQLBoolean, | |
GraphQLID, | |
GraphQLInt, | |
GraphQLInterfaceType, | |
GraphQLList, | |
GraphQLNonNull, | |
GraphQLObjectType, |
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
#!/bin/bash -e | |
get_current_branch() { | |
echo `git symbolic-ref --short HEAD` | |
} | |
get_app_name() { | |
local branch_name=$(get_current_branch) | |
local app_name=$npm_package_name | |
if [ $branch_name != "master" ]; then |