Skip to content

Instantly share code, notes, and snippets.


Jimmy Jia taion

Block or report user

Report or block taion

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
taion / foo.entrypoint.js
Last active Nov 10, 2019
Router strawman
View foo.entrypoint.js
// You can imagine some shorthand for generating this given a component and
// a Relay query.
import React from 'react';
import getFoo from './getFoo';
import lazyComponent from './lazyComponent';
export default function fooEntrypoint({ fooId }) {
const Component = lazyComponent(import('Foo'));
View useSubscription.ts
import isEqual from 'lodash/isEqual';
import { useContext, useEffect, useRef } from 'react';
import { ReactRelayContext, requestSubscription } from 'react-relay';
import {
} from 'relay-runtime';
import useCommittedRef from '@restart/hooks/useCommittedRef';
import usePrevious from '@restart/hooks/usePrevious';
taion / Route.js
Created Aug 14, 2019
Found Relay <Route>
View Route.js
import HttpError from 'found/lib/HttpError';
import BaseRoute from 'found/lib/Route';
import React from 'react';
import LoadingIndicator from '@bfly/ui/lib/LoadingIndicator';
function defaultGetDataFrom({ location }) {
return location.action === 'POP' ? 'STORE_OR_NETWORK' : 'STORE_THEN_NETWORK';
export function createRender({ prerender, render, renderFetched }) {
taion / Pipfile
Last active Nov 1, 2017
Token exchange
View Pipfile
url = ""
verify_ssl = true
name = "pypi"
flask = "*"
View NetworkLayer.js
import io from '';
import RelayNetworkLayer from '@taion/relay-network-layer';
dispose() {},
View runQuery.js
import Relay from 'react-relay';
export default function runQuery(
forceFetch = false,
) {
const query = Relay.createQuery(queryNode, args);
taion / server.js
Last active Nov 1, 2019
GraphQL subscription server with Socket.IO, backed by Redis Pub/Sub
View server.js
const redisClient = redis.createClient(REDIS_URL);
const listeners = Object.create(null);
function addListener(channel, listener) {
if (!listeners[channel]) {
listeners[channel] = [];
taion / makeRequired.js
Created Aug 21, 2016
GraphQL CRUD partial updates
View makeRequired.js
/* @flow */
import { GraphQLNonNull } from 'graphql';
export default function makeRequired(partial?: boolean) {
if (partial) {
return (type: mixed) => type;
return (type: mixed) => new GraphQLNonNull(type);
View Route.js
import invariant from 'invariant';
import React from 'react';
import BaseRoute from 'react-router/lib/Route';
import LoadingIndicator from './LoadingIndicator';
// This is not a component.
/* eslint-disable react/prop-types */
function render({ props, element }) {
if (!props) {
taion / Button.js
Last active Jul 31, 2016
Embarrassing strawman API proposal that hopefully gets the point across
View Button.js
// This is _not_ supposed to be a real API. It's only intended to describe what
// I'm looking for. It's almost intentionally awful.
export const buttonHook = new OverrideHook({
properties: ['margin'],
export default function Button(props) {
return (
You can’t perform that action at this time.