I hereby claim:
- I am apostopher on github.
- I am apostopher (https://keybase.io/apostopher) on keybase.
- I have a public key ASBLlA8h4HbMcfMCjTXL8iLttirhstwSS2-Dh2-KcDRSzQo
To claim this, I am signing this object:
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
const receiptMachine = Machine( | |
{ | |
key: 'ReceiptMachine', | |
initial: 'initializing', | |
states: { | |
idle: { | |
on: { | |
purchase: 'purchasing', | |
}, | |
}, |
import { GraphQLServer } from 'graphql-yoga' | |
// Import the resolvers | |
import resolvers from 'src/resolvers' | |
// Import our custom directive | |
import isAuthenticated from 'src/isAuthenticated' | |
const server = new GraphQLServer({ | |
typeDefs: `${__dirname}/schema.graphql`, |
import { SchemaDirectiveVisitor } from 'graphql-tools' | |
export function authenticate(resolver, { strict = true } = {}) { | |
return async (source, args, context, info) => { | |
const { req } = context | |
const token = getTokenFromReq(req) | |
try { | |
const currentUser = await context.loadUserFromToken(token) | |
context.currentUser = currentUser | |
context.authToken = token |
directive @isAuthenticated(strict: Boolean) on FIELD_DEFINITION | |
type Post { | |
title: String! | |
body: String! | |
} | |
type Query { | |
getPosts: [Post] | |
} |
I hereby claim:
To claim this, I am signing this object:
import { GraphQLNonNull } from 'graphql'; | |
import { fromGlobalId } from 'graphql-relay'; | |
export const RelayGlobalID = new GraphQLScalarType({ | |
name: 'RelayGlobalID', | |
description: 'The RelayGlobalID scalar type represents a globalIdField in relay.', | |
serialize(value) { | |
return value; | |
}, | |
parseValue(value) { |
# These are my notes from the PragProg book on CoffeeScript of things that either | |
# aren't in the main CS language reference or I didn't pick them up there. I wrote | |
# them down before I forgot, and put it here for others but mainly as a reference for | |
# myself. | |
# assign arguments in constructor to properties of the same name: | |
class Thingie | |
constructor: (@name, @url) -> | |
# is the same as: |