Skip to content

Instantly share code, notes, and snippets.

Jared Palmer jaredpalmer

Block or report user

Report or block jaredpalmer

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
View SketchSystems.spec
Formik
IDLE*
setFieldValue -> VALIDATING
setValues -> VALIDATING
setTouched -> VALIDATING
setFieldTouched -> VALIDATING
handleChange -> VALIDATING
handleBlur -> VALIDATING
handleSubmit -> Submit Attempted
submitForm -> Submit Attempted
@jaredpalmer
jaredpalmer / SketchSystems.spec
Created Jul 10, 2018
Knowledge Base Landing Page
View SketchSystems.spec
Knowledge Base Landing Page
Logged In
Has Wiki Access
redirect -> Wiki
No Wiki Access
click purchase 99 button -> Member Wiki Checkout
Logged Out*
click purchase 99 button -> Member Login Before Wiki Checkout
click purchase 649 button -> Prospect Signup
View SketchSystems.spec
Landing Page
Member
click purchase 99 button -> Members Checkout
click already subscribed -> Member Login
Non Member*
click purchase 649 button -> Prospect Signup
click purchase as a member button -> Member Login
click already subscribed -> Member Login
Member Login
@jaredpalmer
jaredpalmer / Hoverable.js
Created Mar 1, 2018 — forked from necolas/Hoverable.js
Hover styles in React Native for Web
View Hoverable.js
import createHoverMonitor from './createHoverMonitor';
import { element, func, oneOfType } from 'prop-types';
import React, { Component } from 'react';
const hover = createHoverMonitor();
/**
* Use:
* <Hoverable>
* {(hover) => <View style={hover && styles.hovered} />}
View sw-update-hook.js
if (typeof window!=='undefined' && navigator.serviceWorker && navigator.serviceWorker.controller) {
let reloadOnNext = false;
let pushState = history.pushState;
history.pushState = function(state, title, url) {
pushState.call(this, state, title, url);
if (reloadOnNext===true) location.reload(true);
};
navigator.serviceWorker.controller.addEventListener('statechange', e => {
@jaredpalmer
jaredpalmer / postinstall.js
Last active Jun 11, 2019
React Native Web x TypeScript
View postinstall.js
// ./postinstall.js
'use strict';
const fs = require('fs');
const RN_TSD = __dirname + '/node_modules/@types/react-native/index.d.ts';
const raw = fs.readFileSync(RN_TSD);
// Fix @types/node conflict
// @see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15960
@jaredpalmer
jaredpalmer / razzle.config.js
Created Jan 25, 2018
Razzle TS real-world setup
View razzle.config.js
'use strict';
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const scssPlugin = new ExtractTextPlugin(
'static/css/[name].[contenthash:8].css'
);
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
@jaredpalmer
jaredpalmer / ScaleToViewport.tsx
Last active Dec 19, 2017
Vjeux's 2013 Viewport Image Resizer as a Render Prop
View ScaleToViewport.tsx
import * as React from 'react';
import { throttle } from 'common/utils/throttle';
export interface ScaleToViewportProps {
height: number;
width: number;
verticalPadding: number;
horizontalPadding: number;
throttle: number;
render: (props: ScaleToViewportState) => React.ReactNode;
@jaredpalmer
jaredpalmer / EmailInput.jsx
Created Nov 29, 2017
Formik async email signup input
View EmailInput.jsx
import React from 'react';
import debounce from 'utils/debounce';
class EmailInput extends React.Component {
checkEmail = value => {
// only check if the field passes Yup email validation first
if (
!this.props.form.errors[this.props.name].includes(
'invalid' /* or whatever your error message is*/
)
View game.py
import math
def nCr(num, kVal):
"""Returns a nCr combination
Args:
num (int): The numerator.
kVal (str): The size of the set.
You can’t perform that action at this time.