Skip to content

Instantly share code, notes, and snippets.

View stackdumper's full-sized avatar

Elijah A. stackdumper

View GitHub Profile
import * as React from 'react'
import { Redirect } from 'react-router-dom'
import queryString from 'qs'
export const withRedirect = <P extends Object>(
reaction: (any) => boolean,
redirect: string | ((props: P) => string),
) => (WrappedComponent) => {
const WithRedirectWrapper = (props: P) => {
@stackdumper
stackdumper / android_instructions.md
Created August 23, 2018 15:04 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@stackdumper
stackdumper / unwrap.ts
Created August 31, 2018 11:00
Unwrap promise
export type Resolved<T> = T extends Promise<infer U> ? U :
T extends (...args: any[]) => Promise<infer U> ? U :
T
@stackdumper
stackdumper / .prettierrc
Last active April 10, 2019 19:32
Prettier typescript config
{
"semi": false,
"tabWidth": 2,
"printWidth": 90,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"parser": "typescript",
@stackdumper
stackdumper / tsconfig.json
Last active February 9, 2019 15:44
Typescript config
{
"compilerOptions": {
"target": "esnext",
"module": "none",
"lib": ["dom", "esnext"],
"jsx": "preserve",
/* Module Resolution Options */
"moduleResolution": "node",
"baseUrl": "./",
export default {
compileEnhancements: false,
extensions: ['ts'],
require: ['ts-node/register', 'tsconfig-paths/register'],
sources: ['src/**/*'],
}
import ava from 'ava'
import nanoid from 'nanoid'
import mongoose from 'mongoose'
/*
test wrapper for ava
creates new database and drops it afterwards
*/
export const test = (message, cb) =>
ava(message, async (t) => {
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"lib": ["esnext"],
"jsx": "preserve",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
@stackdumper
stackdumper / settings.json
Last active March 5, 2019 09:16
My VSCode settings
{
"workbench.colorTheme": "One Dark Pro Bold",
"editor.fontFamily": "'Fira Code'",
"editor.fontLigatures": true,
"window.zoomLevel": 0.9,
"workbench.iconTheme": "file-icons",
"workbench.statusBar.visible": false,
"editor.minimap.enabled": false,
"editor.scrollBeyondLastLine": false,
"files.insertFinalNewline": true,
type Replace<Target extends Record<string, any>, Value extends any> = {
[Key in keyof Target]: Target[Key] extends object
? Replace<Target[Key], Value>
: Value
}