This file contains hidden or 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 compose = (...fns) => x => [...fns].reverse().reduce((acc, fn) => fn(acc), x); | |
| const compose = (...fns) => { | |
| const [first, ...rest] = [...fns].reverse(); | |
| return (...args) => rest.reduce((acc, fn) => fn(acc), first(...args)); | |
| } |
This file contains hidden or 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 } from 'react'; | |
| import fetch from 'unfetch' | |
| class FetchAsync extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { isFetching: false }; | |
| } | |
| async fetch = () => { |
This file contains hidden or 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 ... | |
| import { SmolComponent } from './SmolComponent'; | |
| export class BigOleComponent { } |
This file contains hidden or 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 createContext = value => { | |
| const context = reactCreateContext(value); | |
| export const withContext = Component => { | |
| const C = props => ( | |
| <context.Consumer> | |
| {context => <Component {...context} {...props} />} | |
| </context.Consumer> | |
| ); |
This file contains hidden or 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
| .container-layout { | |
| min-height: 60px; | |
| max-width: 600px; | |
| margin: auto; | |
| padding: 0 5px; | |
| } | |
| .container-flex { | |
| display: flex; | |
| justify-content: space-between; |
This file contains hidden or 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
| { | |
| "singleQuote": true, | |
| "trailingComma": "all", | |
| "useTabs": true, | |
| "tabWidth": 4, | |
| "printWidth": 100 | |
| } |
This file contains hidden or 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 AppContextConsumer = ({ children }) => ( | |
| <PermissionContext.Consumer> | |
| {permissions => ( | |
| <ThemeContext.Consumer> | |
| {theme => children({ permissions, theme })} | |
| </ThemeContext.Consumer> | |
| )} | |
| </PermissionContext.Consumer> | |
| ); |
This file contains hidden or 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 cached = fn => { | |
| const c = Object.create(null); | |
| return a => { | |
| if (a in c) return c[a]; | |
| const value = fn(a); | |
| c[a] = value; | |
| return value; | |
| }; |
This file contains hidden or 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 dkr-die="docker ps -a -q | xargs docker stop | xargs docker rm" |
This file contains hidden or 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
| // could you do something like this: | |
| const actionsToTake = actions.filter(({ type }) => type.endsWith('_FAILURE')); | |
| yield actionsToTake.map(action => takeEvery(action.type, genericSaga)); |