Skip to content

Instantly share code, notes, and snippets.

@EmperorEarth
EmperorEarth / US Zip Codes from 2013 Government Data
Created November 26, 2016 16:07 — forked from erichurst/US Zip Codes from 2013 Government Data
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993
@EmperorEarth
EmperorEarth / !overview
Last active January 29, 2017 17:43
RFC, Relay derivation
Container-local reasoning
Make containers able to fetch their own data without having to notify every ancestor
Drag-n-droppable components/containers
Root entry (usually index.js) takes in the 'schema.json' or 'schema.graphql' as a dependency, and parses schema
Every fragment and root query will be available then to every container
Containers can then fetch their own data without having to ask their parents and their parents... to do it
From the example below, you can introduce/remove <UserProfilePic /> to/from <Foo /> or <Bar /> without having to tell 20+ parents.
@EmperorEarth
EmperorEarth / 001.sql
Last active February 15, 2017 17:11
global db in newssite
use `newssite`;
CREATE TABLE `post` (
`id` BINARY(16) NOT NULL,
`title` CHAR(50) NOT NULL,
`body` TEXT NOT NULL,
PRIMARY KEY (`id`)
)
COLLATE='latin1_general_cs'
ENGINE=InnoDB;
fetch(url, {opts})
.then(response => response.headers.get(`Authorization`))
We've found a bug for you!
C:\code\src\git.cheung.nyc\kevin\firstRE\re\app.re
7 Γöå <Text style=Style.(style [color "#000"]) value="hello world" />
8 Γöå <Text style=Style.(style [color "#000"]) value=(string_of_int 10) />
9 Γöå <Test />
10 Γöå <Greeting name="John" />
11 Γöå </View>;
class Dashboard extends Component {
constructor(props) {
super(props)
// bind? slows down the initialization path, looks awful
// when you have 20 of them (I have seen your code, I know)
// and it increases bundle size
this.handleStuff = this.handleStuff.bind(this)
// _this is ugly.

Legend

This is a command in the Docker Quickstart Terminal

$ This is a command run inside the docker host or inside a container (linux etc, eg after docker-machine ssh default or docker run -it ubuntu bash)

Install Docker Toolbox

  1. start docker quick-start terminal
package cond
import (
"context"
"strconv"
"sync"
"sync/atomic"
"testing"
)
@EmperorEarth
EmperorEarth / core.go
Last active June 23, 2018 21:38
domain errors implementation
package core
import (
"context"
"fmt"
"runtime"
"strings"
)
type WrappedError interface {
@EmperorEarth
EmperorEarth / latency.txt
Created January 27, 2019 13:03 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD