- We use
flexbox
for our layout. - We want to add horizontal and vertical gutters inbetween these items.
- Items wrap according to contents (
flex-wrap: wrap
), therefore we can't decide when/where to apply gutters using breakpoints.
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
#compdef git-merge-pr | |
_git-merge-pr () { | |
# Note: requires hub and jq to be installed | |
# https://developer.github.com/v3/pulls/#list-pull-requests | |
# hub api /repos/{owner}/{repo}/pulls | |
PRS=$( | |
hub api /repos/{owner}/{repo}/pulls \ | |
| jq 'map({title, number, head})' |
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 * as React from 'react'; | |
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react'; | |
const myHoc = <ComposedComponentProps extends {}>( | |
ComposedComponent: ComponentClass<ComposedComponentProps>, | |
) => { | |
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>; | |
type WrapperComponentProps = ComposedComponentProps & { | |
wrapperComponentProp: number; |
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 tuple = <T extends Array<unknown>>(...args: T): T => args; | |
// `Object.keys` does not return the keys as string literals, only strings. Use this helper as a | |
// workaround. https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 | |
const keys = <O extends object>(obj: O) => Object.keys(obj) as Array<keyof O>; | |
// `Object.entries` is ES2017, so we must define our own version. | |
const entries = <K extends string, V>(obj: Record<K, V>) => | |
keys(obj).map(key => tuple(key, obj[key])); | |
const fromEntries = <K extends string, V>(arr: Array<[K, V]>) => |
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, { SFC } from 'react'; | |
import { MapDispatchToPropsParam, MapStateToPropsParam } from 'react-redux'; | |
import { StateRoot } from 'reducers/types'; | |
import { AnyAction, Dispatch } from 'redux'; | |
// | |
// Helpers | |
// | |
const createSubType = <T extends any>() => <SubType extends T>(subType: SubType) => subType; |
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 type Node<P> = { | |
value: P; | |
children: Array<Tree<P>>; | |
}; | |
type Leaf<P> = { | |
value: P; | |
}; | |
enum TreeTag { |
tsc && node main.js
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 store = configureAndCreateReduxStore(); | |
const { ReduxProvider, ReduxConsumer } = createReactRedux(store); | |
export const FormConnected: React.SFC<OwnProps> = ownProps => ( | |
<ReduxConsumer> | |
{pipe( | |
({ state, dispatch }) => ({ | |
...ownProps, | |
...mapStateToProps(state, ownProps), |
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 { Diff } from 'typelevel-ts'; | |
// Higher-order function | |
const withDefaultsFn = <DefaultParams extends object, Params extends DefaultParams, Result>( | |
fn: (params: Params) => Result, | |
defaultParams: DefaultParams, | |
) => (inputParams: Diff<Params, keyof DefaultParams>): Result => | |
fn({ | |
// We cast spreaded objects to any to workaround TS issue when spreading generic objects | |
// https://github.com/Microsoft/TypeScript/issues/14409 |
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 urlHelpers, { Url, UrlWithParsedQuery, UrlWithStringQuery } from 'url'; | |
import queryStringHelpers from 'querystring'; | |
import { Option } from 'funfix-core'; | |
import pipe from 'lodash/flow'; | |
import { ParsedUrlQuery } from 'querystring'; | |
const isNonEmptyString = (str: string) => str.length > 0; | |
// https://github.com/gcanti/fp-ts/blob/15f4f701ed2ba6b0d306ba7b8ca9bede223b8155/src/function.ts#L127 | |
const flipCurried = <A, B, C>(fn: (a: A) => (b: B) => C) => (b: B) => (a: A) => |