By
const type = `
type User {
id: Int!
email: String
courses: [Course]
}
import { createServer, Server } from 'http'; | |
import { test as base } from '@playwright/test'; | |
import path from 'path'; | |
import serve from 'serve-handler'; | |
type StaticWorkerFixtures = { | |
port: number; | |
server: Server; | |
}; |
const axios = require("axios"); | |
const R = require("ramda"); | |
module.exports = async (latitude = 0, longitude = 0) => { | |
const { data } = await axios.get("https://api.foursquare.com/v2/venues/explore", { | |
params: { | |
client_id: process.env.FOURSQUARE_CLIENT_ID, | |
client_secret: process.env.FOURSQUARE_CLIENT_SECRET, | |
v: 20180707, | |
section: "coffee", |
import 'isomorphic-fetch' | |
import { getDataFromTree, ApolloProvider } from 'react-apollo/lib/index' | |
import { ApolloClient, createNetworkInterface } from 'apollo-client' | |
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'; | |
import { omit } from 'lodash' | |
const isServer = (typeof window === 'undefined') | |
const makeClient = () => new ApolloClient({ | |
ssrMode: true, |
// tools.generateId | |
function generateId(size){ | |
var text = []; | |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
for( var i=0; i < size; i++ ) | |
text.push(possible.charAt(Math.floor(Math.random() * possible.length))); | |
return text.join(''); | |
} |
import React, { Component, PropTypes } from 'react' | |
import {dataConnect} from 'relate-js'; | |
import { Link } from 'react-router' | |
const data = ( | |
null, | |
null, | |
(props) => ({ | |
fragments: { | |
viewer: { |
import { simplifyAST } from 'graphql-sequelize' | |
const parseFields = (ast) => { | |
let s = simplifyAST(ast[0]) | |
return Object.keys(s.fields) | |
} | |
// and then in use: | |
accounts: { | |
type: new GraphQLList(accountType), |
// define libraries you would need | |
var oauth = require('oauth') | |
var AWS = require('aws-sdk') | |
var cuid = require('cuid') | |
// define your OAuth-application credentials | |
var twitterConsumerKey = 'xxxxxxxxxxxxxxxxxxxx' | |
var twitterConsumerSecret = 'xxxxxxxxxxxxxxxxxxxx' | |
// ensure AWS is requesting the nearest region |
CREATE TABLE accounts( | |
id serial PRIMARY KEY, | |
name VARCHAR(256) NOT NULL | |
); | |
CREATE TABLE entries( | |
id serial PRIMARY KEY, | |
description VARCHAR(1024) NOT NULL, | |
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
-- Every entry is a credit to one account... |
export default class FormWrapper { | |
render () { | |
const Form = makeForm(['name', 'age', 'sex']); | |
return ( | |
<div> | |
<Form /> | |
</div> | |