// Example component: render the current value of a stream. Support switching streams during the lifecycle of the component | |
// N.B. code is untested | |
// Old: | |
class RenderStream extends Component { | |
subscription | |
componentWillMount() { | |
this.subscribeToStream(this.props.stream) | |
} |
import styled, { css } from 'emotion/react' | |
import { space, width, fontSize, color, responsiveStyle } from 'styled-system' | |
export const display = responsiveStyle('display') | |
export const flex = responsiveStyle('flex') | |
export const order = responsiveStyle('order') | |
const wrap = responsiveStyle('flex-wrap', 'wrap', 'wrap') | |
const direction = responsiveStyle('flexDirection', 'direction') | |
const align = responsiveStyle('alignItems', 'align') |
import React from 'react' | |
import styled from 'emotion/react' | |
import { omit } from 'emotion/lib/utils' | |
import { space, width, fontSize, color, responsiveStyle } from 'styled-system' | |
import { baseCss } from './ui' | |
const defaultExcludedProps = [ | |
'm', | |
'mt', |
A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.
With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.
We use GraphQL to dyn
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>React Quick Prototyping</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.min.js"></script> |
// ES6 w/ Promises | |
// Note: From a React starter template - see https://t.co/wkStq8y3I5 | |
function fetchData(routes, params) { | |
let data = {}; | |
return Promise.all(routes | |
.filter(route => route.handler.fetchData) | |
.map(route => { | |
return route.handler.fetchData(params).then(resp => { | |
data[route.name] = resp; |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
''' | |
AWS S3 Gzip compression utility | |
Author: Dmitriy Sukharev | |
Modified: 2013-09-11 | |
------- | |
Synchronizes directory with gzipped content of Amazon S3 bucket with local |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: