Skip to content

Instantly share code, notes, and snippets.

View kevinwucodes's full-sized avatar

Kevin Wu kevinwucodes

View GitHub Profile
@kevinwucodes
kevinwucodes / realtime.html
Created June 27, 2014 07:12
plotting realtime coordinates for hackathon's adopt-a-block
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers</title>
<SCRIPT TYPE="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></SCRIPT>
@kevinwucodes
kevinwucodes / fileupload.html
Created September 10, 2014 06:33
file upload test using FormData and XMLHttpRequest
<html>
<head>
<title>FormData file test</title>
<SCRIPT TYPE="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></SCRIPT>
</head>
<body>
<input id="filebutton" type='file' />
@kevinwucodes
kevinwucodes / async-await-reject.js
Created December 7, 2016 00:24
async await sandbox
const prom = () => new Promise((resolve, reject) => {
setTimeout(() => {
reject('got rejected')
}, 2000)
})
const foo = async () => {
try {
console.log('good', await prom())
} catch(err) {
@kevinwucodes
kevinwucodes / react-components-props-spread-operator.js
Last active December 12, 2016 21:57
react components prop spread operator sandbox
//http://www.webpackbin.com/NkMEv-_7M
import React from 'react';
import {render} from 'react-dom';
import HelloWorld from './HelloWorld.js';
const divContainer = document.querySelector('#app')
const obj1 = {
first: 'kevin'
@kevinwucodes
kevinwucodes / onename.txt
Created August 27, 2017 20:03
onename verification
Verifying that "kevinwu.id" is my Blockstack ID. https://onename.com/kevinwu
### Keybase proof
I hereby claim:
* I am kevinwucodes on github.
* I am kevinwu (https://keybase.io/kevinwu) on keybase.
* I have a public key whose fingerprint is 1CD7 0CF4 B2B2 787F A3A0 93FF 9EE9 8632 FCFC AA9D
To claim this, I am signing this object:
@kevinwucodes
kevinwucodes / readme.md
Last active October 11, 2017 00:28
All about transformers and reducers (aka transducers)

Eric Elliott had an interesting tweet that intrigued me: https://twitter.com/_ericelliott/status/912407669683609600?s=03

Here's what he posted:

const map = transform => reducer => ((acc, current) => reducer(acc, transform(current)))

const filter = predicate => reducer => (
  (acc, current) => predicate(current) ? reducer(acc, current) : acc
)
@kevinwucodes
kevinwucodes / using-debounce.md
Last active October 16, 2017 01:11
ways to use debounce in React
@kevinwucodes
kevinwucodes / readme.md
Last active October 19, 2017 19:45
puppeteer v0.12 experiments

page.evaluate

const a = await page.evaluate(selector => document.querySelector(selector).textContent, WELCOMETAG_SELECTOR)

page.$eval

const b = await page.$eval(WELCOMETAG_SELECTOR, stuff => stuff.textContent)
@kevinwucodes
kevinwucodes / readme.md
Created August 5, 2018 01:46
Understanding JavaScript Functions

Today, I got stumped. Let's get unstumped.

While watching André Staltz's excellent Two Fundamental Abstractions talk, he shared something like this about 24 minutes into his talk:

const a = b => b(10)

a(x => console.log(x))