Skip to content

Instantly share code, notes, and snippets.

View jbaxleyiii's full-sized avatar
💼
Moved to management

James Baxley jbaxleyiii

💼
Moved to management
View GitHub Profile
<div id="JIRA"></div>
<script>
document.addEventListener("DOMContentLoaded",function(){window.ATL_JQ_PAGE_PROPS=$.extend(window.ATL_JQ_PAGE_PROPS,{triggerFunction:function(a){setTimeout(function(){a(),$("#atlwdg-blanket").remove(),$("#atlwdg-container").appendTo("#JIRA"),$("#atlwdg-container").css({width:"100%",position:"relative"})},50)}}),jQuery.ajax({url:"https://newspring.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/-inl9m0/b/c/3d70dff4c40bd20e976d5936642e2171/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-US&collectorId=7c75f72b",type:"get",cache:!0,dataType:"script"})});
</script>
@jbaxleyiii
jbaxleyiii / app.js
Last active May 2, 2017 02:11
Heighliner (Functional GraphQL Server)
import express from "express";
import bodyParser from "body-parser";
import { graphqlExpress } from "graphql-server-express";
const PORT = 3000;
import schema from "./schema";
express()
.use(
"/graphql",
@jbaxleyiii
jbaxleyiii / heighliner.js
Last active May 4, 2017 22:44
Heighliner [Functional GraphQL Server Framework]
import { graphql } from "graphql";
import { Schema, Type, Field, IntType, StringField } from "../schema";
it("creates an executable schema", async () => {
// build field resolvers
// these will implement Functor and Semigroup (and maybe more)
const code = Field(IntType, ({ code }) => code);
const message = StringField(({ message }) => message);
// create a type from defined fields
import type {
DocumentNode,
ExecutionResult,
GraphQLError,
SelectionSetNode,
FieldNode,
InlineFragmentNode,
ValueNode,
SelectionNode,
NameNode,
@jbaxleyiii
jbaxleyiii / .flowconfig
Created June 4, 2017 02:52
Using flow with react-apollo
[libs]
./node_modules/react-apollo/lib/index.js.flow
./node_modules/apollo-client/lib/index.js.flow
[libs]
./node_modules/react-apollo/lib/index.js.flow
./node_modules/apollo-client/lib/index.js.flow
@jbaxleyiii
jbaxleyiii / component.js
Last active July 29, 2017 16:02
Base component
import React from "react";
import gql from "graphql-tag";
import { graphql } from "react-apollo";
export const HERO_QUERY = gql`
query GetCharacter($episode: Episode!) {
hero(episode: $episode) {
name
id
friends {
@jbaxleyiii
jbaxleyiii / component.js.diff
Last active July 3, 2017 23:22
Component Diff
+ // @flow
import React from "react";
import gql from "graphql-tag";
import { graphql } from "react-apollo";
+ import type { OperationComponent } from "react-apollo";
export const HERO_QUERY = gql`
query GetCharacter($episode: Episode!) {
hero(episode: $episode) {
export default withCharacter(({ loading, hero, error }) => {
// $ExpectError [number] this type cannot be compared to boolean
if (loading > 1) return <div>Loading</div>;
if (error) return <h1>error.name</h1>;
return ...;
}
@jbaxleyiii
jbaxleyiii / options.js.diff
Last active June 4, 2017 03:55
Options diff
+ export type InputProps = {
+ episode: string,
+ };
+ export const withCharacter: OperationComponent<Response, InputProps> = graphql(HERO_QUERY, {
- export const withCharacter: OperationComponent<Response> = graphql(HERO_QUERY, {
+ options: ({ episode }) => ({
+ variables: { episode },
- options: () => ({