Skip to content

Instantly share code, notes, and snippets.

📱
Building an Android and iOS React Native App. Freelancing. Remote UK => AUS

Mike James export-mike

📱
Building an Android and iOS React Native App. Freelancing. Remote UK => AUS
  • Sydney, AU
Block or report user

Report or block export-mike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@export-mike
export-mike / mcc.json
Last active Jun 6, 2019
Stripe MCC.json - https://stripe.com/docs/connect/setting-mcc collected using pup, jq and some manual replacements.
View mcc.json
[{
"code": "ac_refrigeration_repair",
"value": "7623",
"name": "A/C Refrigeration Repair"
},
{
"code": "accounting_bookkeeping_services",
"value": "8931",
"name": "Accounting/Bookkeeping Services"
},
@export-mike
export-mike / index.js
Created Jun 18, 2018
Unstated Offline Container
View index.js
import * as Unstated from 'unstated';
import debounce from 'lodash.debounce';
import clonedeep from 'lodash.clonedeep';
import { Alert } from 'react-native';
import AsyncStorage from '../AsyncStorage';
const noop = () => {};
//set FS storage limit for android: https://codedaily.io/tutorials/4/Increase-Android-AsyncStorage-Size-in-React-Native
export class Container extends Unstated.Container {
debounce = 800;
constructor({ key } = {}) {
View mixingStateWithRenderProps.js
// Before with a higher order component.
import React from 'react';
class UserCreateEdit extends React.Component {
constructor(props) {
super(props);
this.state = {
user: props.user
}
}
@export-mike
export-mike / Example.js
Created Nov 22, 2017
DataLoadingViaRenderProps
View Example.js
import React from 'react';
import Tile from './Tile';
import {WithRequest} from './withRequest';
import Api from '../Api';
import Loading from './Loading';
const OnBoardingTemplates = () => <Tile
title="Users"
to="/users"
actionLabel="Add New"
@export-mike
export-mike / config.yml
Created Nov 15, 2017
circleCI yarn cache
View config.yml
steps:
- checkout
- restore_cache:
keys:
# Find a cache corresponding to this specific yarn.lock checksum
# when this file is changed, this key will fail
- v1-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run:
name: install-yarn
command: npm install -g yarn@v0.24.5
@export-mike
export-mike / Request.js
Last active Nov 8, 2017
ReactRequestHigherOrderComponent - with custom Loading component, leverages async await
View Request.js
import React from 'react';
import Api from '../Api';
import Loading from '../components/Loading';
import Title from '../components/Title';
const withRequest = ({ fetch, prop, defaultState, LoadingComponent }) => Component => class WithRequest extends React.Component {
state = {
[prop]: defaultState,
loading: false,
error: false
@export-mike
export-mike / ReactProvderFactory.js
Last active Nov 8, 2017
ReactProviderFactory.js - create simple providers with accompanying higher order 'with' components to access context.
View ReactProvderFactory.js
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default (propName, propType, contextProp) => {
return {
Provider: createProvider(propName, propType, contextProp),
Hoc: createHigherOrderComponent(propName, propType, contextProp)
}
};
@export-mike
export-mike / ReactProvderFactory.js
Created Nov 8, 2017
ReactProviderFactory.js - create simple providers with accompanying higher order 'with' components to access context.
View ReactProvderFactory.js
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default (propName, propType, contextProp) => {
return {
Provider: createProvider(propName, propType, contextProp),
Hoc: createHigherOrderComponent(propName, propType, contextProp)
}
};
@export-mike
export-mike / index.js
Last active Nov 8, 2017
react-plural
View index.js
import React from 'react';
export default props => {
const messageBuilt = plural(props);
return <span>{messageBuilt}</span>;
};
export const plural = ({ message, ...rest }) => {
const messageBuilt = Object.keys(rest).reduce((messageTemplate, key) => {
if (!Array.isArray(rest[key])) {
@export-mike
export-mike / dropDataGraphCool.js
Created Jul 19, 2017
A utility Script for cleaning out tables in graphcool
View dropDataGraphCool.js
require('dotenv').config();
const { GraphQLClient } = require('graphql-request');
const client = new GraphQLClient(process.env.ENDPOINT, { headers: {
'Authorization': `Bearer ${process.env.ACCESS_TOKEN}`
}});
const query = T => `
query Get${T}s {
all${T}s {
id
You can’t perform that action at this time.