Skip to content

Instantly share code, notes, and snippets.

View andycarrell's full-sized avatar

Andy Carrell andycarrell

View GitHub Profile
// Returns 'a' middleware
const combineMiddlewares = (...middlewares) => store => {
// Map over applying store
const stored = middlewares.map(mw => mw(store))
return next => {
// Map over applying the next as 'next'
const [first, ...rest] = stored
const nextMiddlewares = [...rest, next]
// Should this be done in reverse?
// (apply 'next', then through the chain & mutate locally?)
import thisApiMw from './thisApiMw'
import thatApiMw from './thatApiMw'
import someApiMw from './someApiMw'
const mws = {
thisApiMw,
thatApiMw,
someApiMw
}
class FormWithSomeCouponInput extends React.Component {
constructor(props) { ... }
handleSubmitCoupon() {
const { coupon, actions } = this.props;
actions.submitCoupon({ coupon });
}
handleCouponBlur() {
class FormWithSomeCouponInput extends React.Component {
constructor(props) { ... }
handleCouponBlur() {
const { coupon, actions } = this.props;
actions.applyBlur('coupon');
actions.submitCoupon({ coupon });
}
class FormWithSomeCouponInput extends React.Component {
constructor(props) { ... }
handleCouponBlur() {
const { coupon, actions } = this.props;
actions.applyBlur('coupon');
actions.submitCoupon({ coupon });
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: "stable",
// Still not sure why object spread is not full spec...
const spread = (...objs) => Object.assign({}, ...objs);
const safeSpread = (...objs) => Object.assign({}, ...objs.map(o => o || {}));
const spicify = ([first, ...rest]) => [...rest].reduce((acc, i) => `${acc} ${i.toUpperCase()}`, first.toUpperCase());
spicify('spicey');
// Settings
{
"breadcrumbs.enabled": false,
"editor.fontFamily": "FiraCode-Retina, FiraCode-Retina", // Need to download this font
"editor.fontLigatures": true,
"editor.insertSpaces": false,
"editor.renderWhitespace": "all",
"editor.wordWrap": "off",
"explorer.confirmDelete": false,
"explorer.enableDragAndDrop": false,
import { connect } from 'react-redux';
import * as selectors from '../selectors';
const fnNameFor = ([first, ...rest]) => (`get${first.toUpperCase()}${rest.join('')}`);
const selectFor = key => selectors[fnNameFor(key)];
const getMapStateFor = stateKeys => state => stateKeys.reduce(
(acc, key) => ({ ...acc, [key]: selectFor(key)(state) }),
{},