Skip to content

Instantly share code, notes, and snippets.

🏪
Working from Taipei

Jeff Lau jefflau

🏪
Working from Taipei
Block or report user

Report or block jefflau

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 gist:b0f531012aafd5f3ff6fa2720f58e78b
export function sendHelper(tx) {
return new Promise((resolve, reject) => {
tx()
.on('transactionHash', txHash => {
const txState = 'Pending'
addTransaction({ txHash, txState })
resolve(txHash)
})
.on('receipt', receipt => {
const txHash = receipt.transactionHash
@jefflau
jefflau / cloudinary.js
Created Feb 28, 2019
Cloudinary unsigned upload
View cloudinary.js
const cloudName = 'xxxxxx'
const cloudinaryUrl = `https://api.cloudinary.com/v1_1/${cloudName}/upload`
const unsignedUploadPreset = 'xxxxxx'
export function upload(file) {
const body = new FormData()
body.append('file', file)
body.append('upload_preset', unsignedUploadPreset)
return (
View useMedia.js
const useMedia = (query, defaultState) => {
const [state, setState] = useState(defaultState)
useEffect(
() => {
let mounted = true
const mql = window.matchMedia(query)
const onChange = () => {
if (!mounted) return
setState(!!mql.matches)
View useEditable.js
export function useEditable(
initialState = {
editing: false,
newValue: '',
pending: false,
confirmed: false,
txHash: undefined
}
) {
const types = {
@jefflau
jefflau / mediaQuery.js
Last active Oct 14, 2018
mediaQuery.js
View 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 Sep 26, 2018
ensTypes.graphql
View ensTypes.graphql
type Address {
address: String
}
type Node {
name: String
nameHash: String
label: String
node: String
subNodes: [Node]
View gist:763ae8197fee2a872fedbe062007c13c
[
{
"constant": false,
"inputs": [
{
"name": "_hash",
"type": "bytes32"
}
],
"name": "releaseDeed",
View gist:d23bc0cc6f0f1ba2f8d0322851c4c4bc
[
{
"constant": true,
"inputs": [
{
"name": "node",
"type": "bytes32"
}
],
"name": "resolver",
@jefflau
jefflau / App.js
Last active Aug 5, 2018
Multiple layouts with React Router V4
View App.js
/* 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'
View gist:9e54ea959d5b590ce7c9460ef53f3183
### 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:
You can’t perform that action at this time.