Skip to content

Instantly share code, notes, and snippets.

View rosskevin's full-sized avatar

Kevin Ross rosskevin

View GitHub Profile
@rosskevin
rosskevin / cloudSettings
Last active November 21, 2019 21:14
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-11-21T21:14:36.267Z","extensionVersion":"v3.4.3"}
@rosskevin
rosskevin / Query.tsx
Created September 26, 2018 19:32
Internal wrapper around react-apollo query
import findQueryName from '@alienfast/common/apollo/findQueryName'
import Logger from '@alienfast/common/Logger'
import * as React from 'react'
import { ErrorInfo } from 'react'
import {
OperationVariables,
Query as ApolloQuery,
QueryProps as ApolloQueryProps,
QueryResult,
} from 'react-apollo'
@rosskevin
rosskevin / createStyled.ts
Created September 24, 2018 19:13
createStyled typescript
import {
StyledComponentProps,
StyleRules,
StyleRulesCallback,
WithStyles,
} from '@material-ui/core/styles'
import withStyles, { WithStylesOptions } from '@material-ui/core/styles/withStyles'
import * as React from 'react'
import { PropInjector } from "@material-ui/core";
@rosskevin
rosskevin / StripeCardsSection.js
Created March 29, 2018 21:18 — forked from lfalke/StripeCardsSection.js
Usage of react-stripe-elements with Material UI (v1.0) styling
import React, { PureComponent } from 'react'
import Grid from 'material-ui/Grid'
import { CardNumberElement, CardExpiryElement, CardCVCElement } from 'react-stripe-elements'
import StripeElementWrapper from './StripeElementWrapper'
export default class extends PureComponent {
static displayName = 'StripeCardsSection'
import * as React from 'react'
import * as classNames from 'classnames'
import { StandardProps } from '@alienfast/material-ui'
import { withStyles } from '@alienfast/material-ui/styles'
import Text from '../Text'
import Logger from '../util/Logger'
const decorate = withStyles(
({ palette, shadows, transitions }) => ({
root: {
@rosskevin
rosskevin / hoc-template.tsx
Last active August 23, 2020 19:44
Typescript higher order component (hoc) template
/* variation on https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1 */
import * as React from 'react'
import { wrapDisplayName } from 'recompose'
// Props you want the resulting component to take (besides the props of the wrapped component)
interface ExternalProps {}
// Props the HOC adds to the wrapped component
export interface InjectedProps {}
@rosskevin
rosskevin / AutoSuggest_AutoSuggest.js
Last active September 26, 2017 06:20
Material-ui AutoSuggest/AutoComplete with react-popper/Popper.js and Portal
// @flow
import React, {Component} from 'react'
import {default as ReactAutoSuggest} from 'react-autosuggest'
import {withStyles, createStyleSheet} from '@alienfast/material-ui/styles'
import Grow from '@alienfast/material-ui/transitions/Grow'
import Logger from '../util/Logger'
import Performance from '../util/Performance'
import {
renderInput,
@rosskevin
rosskevin / NotificationCenter.js
Created June 30, 2017 22:04
material-ui NotificationCenter
// @flow
import Queue from 'es-collections/Queue'
import Snackbar from '@alienfast/material-ui/Snackbar'
import PropTypes from 'prop-types'
import React, {Component} from 'react'
import Logger from './util/Logger'
import Performance from './util/Performance'
import Button from './Button'
@rosskevin
rosskevin / relay.js
Last active June 27, 2018 01:07
flow libdef for relay modern 1.2. This is in a _works for me_ state. Someone please export these properly from relay or create a proper flow-typed libdef.
// @flow
declare module 'react-relay' {
declare export type RecordState = 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN';
declare export type onCompleted = (response: ?Object, errors: ?Array<PayloadError>) => void
declare export type onError = (error: Error) => void
declare export type CommitOptions = {
onCompleted: onCompleted,
@rosskevin
rosskevin / found.js
Last active June 1, 2017 21:33
flow libdef for found
// @flow
// WARNING: WORK IN PROGRESS and will likely submit to flow-typed when workable.
declare module 'found' {
declare type Map = { [key: string]: any }
/**
* Location descriptor string:
* store.dispatch(FarceActions.push('/foo?bar=baz#qux'));
*