Skip to content

Instantly share code, notes, and snippets.

export function useEditable(
initialState = {
editing: false,
newValue: '',
pending: false,
confirmed: false,
txHash: undefined
}
) {
const types = {
@jefflau
jefflau / mediaQuery.js
Last active October 14, 2018 01:31
mediaQuery.js
import { css } from 'styled-components'
const sizes = {
giant: 1170,
desktop: 992,
tablet: 768,
phone: 376
}
// iterate through the sizes and create a media template
@jefflau
jefflau / ensTypes.graphql
Last active September 26, 2018 15:26
ensTypes.graphql
type Address {
address: String
}
type Node {
name: String
nameHash: String
label: String
node: String
subNodes: [Node]
[
{
"constant": false,
"inputs": [
{
"name": "_hash",
"type": "bytes32"
}
],
"name": "releaseDeed",
[
{
"constant": true,
"inputs": [
{
"name": "node",
"type": "bytes32"
}
],
"name": "resolver",
@jefflau
jefflau / App.js
Last active March 27, 2022 11:27
Multiple layouts with React Router V4
/* Inspired by: https://gist.github.com/avinmathew/e82fe7e757b20cb337d5219e0ab8dc2c */
import React, { Fragment } from 'react'
import {
BrowserRouter as Router,
Route as DefaultRoute,
Switch
} from 'react-router-dom'
import TestRegistrar from './routes/TestRegistrar'
import Home from './routes/Home'
import SingleName from './routes/SingleName'
### Keybase proof
I hereby claim:
* I am jefflau on github.
* I am jefflau (https://keybase.io/jefflau) on keybase.
* I have a public key ASB76SCxW1qF2yWjmO_ffbhDiIoFL50sQn1NZkAwgSA_8wo
To claim this, I am signing this object:
@jefflau
jefflau / modulate.js
Created June 15, 2018 09:49
Modulate function - good for parallax on scroll or movement on scroll
export function modulate(value, rangeA, rangeB, limit) {
let fromHigh, fromLow, result, toHigh, toLow
if (limit == null) {
limit = false
}
fromLow = rangeA[0]
fromHigh = rangeA[1]
toLow = rangeB[0]
toHigh = rangeB[1]
result = toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow)
@jefflau
jefflau / package.json
Created April 3, 2018 05:21
Prettier config
"prettier": {
"semi": false,
"editor.formatOnSave": true,
"singleQuote": true
}
0x19bC8Ee574bbF9a591CdfF271971155d8445Ef54