Skip to content

Instantly share code, notes, and snippets.

@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;
@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 / 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

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@EmperorEarth
EmperorEarth / udp_client.go
Created September 6, 2016 03:50 — forked from reterVision/udp_client.go
A dummy UDP hole punching sample in Go
package main
import (
"encoding/json"
"fmt"
"log"
"net"
"os"
"time"
)
import { mockServer, MockList } from 'graphql-tools';
import casual from 'casual-browserify';
// The GraphQL schema. Described in more detail here:
// https://medium.com/apollo-stack/the-apollo-server-bc68762e93b
const schema = `
type User {
id: ID!
name: String
@EmperorEarth
EmperorEarth / main.go
Last active August 3, 2016 07:40 — forked from sogko/main.go
hello-world-graphql-part-1 - Server
package main
import (
"net/http"
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
@EmperorEarth
EmperorEarth / main.go
Last active August 3, 2016 07:39 — forked from sogko/main.go
hello-world-graphql-part-1 - Schema definition (golang)
package main
import (
"github.com/graphql-go/graphql"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.Fields{
"latestPost": &graphql.Field{
@EmperorEarth
EmperorEarth / schema.go
Last active August 3, 2016 06:12 — forked from sogko/schema.go
hello-world-relay-part-2 - Schema definition (golang)
package data
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/relay"
)
var postType *graphql.Object
var queryType *graphql.Object
var Schema graphql.Schema
@EmperorEarth
EmperorEarth / database.go
Last active August 3, 2016 06:01 — forked from sogko/database.go
hello-world-relay-part-1 - In-memory database
package data
// Data model structs
type Post struct {
Id string `json:"id"`
Text string `json:"text"`
}
// Mock data
var latestPost = &Post{