Skip to content

Instantly share code, notes, and snippets.

View LeeCheneler's full-sized avatar

Lee Cheneler LeeCheneler

  • Enzyme Software
  • UK
  • 02:01 (UTC +01:00)
View GitHub Profile
@LeeCheneler
LeeCheneler / index.js
Last active October 1, 2018 14:43
axios refresh tokens in response interceptor example
import axios from 'axios'
import {
refreshTokens,
getTokens,
getLogoutUri,
getRefreshTokensUri
} from "./utils"
/**
* Configure axios to refresh tokens and reflight the request if it fails
@LeeCheneler
LeeCheneler / README.MD
Created October 9, 2018 14:09
Terminal jokes on launch
@LeeCheneler
LeeCheneler / Radio.jsx
Created October 25, 2018 08:29
Example of compound component in React
import React, { Fragment } from 'react'
import T from 'prop-types'
const Button = ({ children, id, value, ...props }) => (
<Fragment>
<input type="radio" id={id} value={value} {...props} />
<label htmlFor={id}>{children}</label>
</Fragment>
)
@LeeCheneler
LeeCheneler / index.js
Created October 30, 2018 09:48
useLocalStorage React Hook
import { useState, useEffect } from 'react';
// Usage
function App() {
// Similar to useState but we pass in a key to value in local storage
// With useState: const [name, setName] = useState('Bob');
const [name, setName] = useLocalStorage('name', 'Bob');
return (
<div>
@LeeCheneler
LeeCheneler / Consumer.jsx
Last active November 1, 2018 15:39
Flag using flex instead of table
import React from 'react'
import Flag from './Flag'
const Consumer = () => (
<Flag.Wrapper spacer="md">
<Flag.Component>Component</Flag.Component>
<Flag.Body>Body</Flag.Body>
</Flag.Wrapper>
)
@LeeCheneler
LeeCheneler / free port
Created November 2, 2018 17:01
Kill process consuming a port
kill -9 $(lsof -t -i:3000)
@LeeCheneler
LeeCheneler / .zshrc
Created January 31, 2019 10:19
Git Aliases got .zshrc
# git aliases
alias g="git"
alias ga="git add -A"
alias gc="git commit"
alias gcm="git commit -m"
alias gp="git push"
alias gch="git checkout"
alias gpu="git pull"
alias gb="git branch"

Keybase proof

I hereby claim:

  • I am leecheneler on github.
  • I am lacheneler (https://keybase.io/lacheneler) on keybase.
  • I have a public key ASAyZnwZx1KKed8kGZYDRqqZKnYdxd4yHvKu5B2EY_3CxAo

To claim this, I am signing this object:

@LeeCheneler
LeeCheneler / wishlist.md
Created July 18, 2019 07:38
Tooling Wish List
  • Fast in browser testing

    • Hot reload app
    • Only run tests related to hot patched code
  • Simple website build platform

    • Stateful SSR
    • Set routes as static in route config to be generated at build time
@LeeCheneler
LeeCheneler / example-usage.tsx
Last active September 12, 2019 07:01
useBreakpoint hook experiment
import React from "react";
import styled from "styled-components";
import { Box } "./some-styled-system";
import { useBreakpoints } from "./use-breakpoints";
// Very contrived example
const ColoredBox = styled.div<{ isRed: Boolean; isBlue: boolean }>`
width: 100px;
height: 100px;