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
// 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?) |
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 thisApiMw from './thisApiMw' | |
import thatApiMw from './thatApiMw' | |
import someApiMw from './someApiMw' | |
const mws = { | |
thisApiMw, | |
thatApiMw, | |
someApiMw | |
} |
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 FormWithSomeCouponInput extends React.Component { | |
constructor(props) { ... } | |
handleSubmitCoupon() { | |
const { coupon, actions } = this.props; | |
actions.submitCoupon({ coupon }); | |
} | |
handleCouponBlur() { |
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 FormWithSomeCouponInput extends React.Component { | |
constructor(props) { ... } | |
handleCouponBlur() { | |
const { coupon, actions } = this.props; | |
actions.applyBlur('coupon'); | |
actions.submitCoupon({ coupon }); | |
} |
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 FormWithSomeCouponInput extends React.Component { | |
constructor(props) { ... } | |
handleCouponBlur() { | |
const { coupon, actions } = this.props; | |
actions.applyBlur('coupon'); | |
actions.submitCoupon({ coupon }); | |
} |
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
// 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", |
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
// 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 || {})); |
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 spicify = ([first, ...rest]) => [...rest].reduce((acc, i) => `${acc} ${i.toUpperCase()}`, first.toUpperCase()); | |
spicify('spicey'); |
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
// 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, |
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 { 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) }), | |
{}, |
OlderNewer