Skip to content

Instantly share code, notes, and snippets.

View kirkness's full-sized avatar
😎

Henry kirkness

😎
View GitHub Profile
@kirkness
kirkness / jumpy-swipe.js
Created January 31, 2019 12:11
React Native Reanimated Spring
import React from 'react';
import { GestureHandler } from 'expo';
import { View } from 'react-native';
import Animated from 'react-native-reanimated';
const { PanGestureHandler, State } = GestureHandler;
const {
event,
set,
type Mutation {
login(email String!, password: String!): String
updateProfile: Profile @withEmailVerified
}
new ApolloServer({
typeDefs,
resolvers,
formatError: error => new Error('Internal server error')
});
# Shema
type Query {
getItemById(id: ID!): Item
}
# Query made by client
query myQuery {
getItemById(id: "*") {
id
}
import { createRateLimitDirective } from 'graphql-rate-limit';
const server = new ApolloServer({
typeDefs: gql`
type Mutation {
# Limit to 10 per minute
login(email: String!, password: String!): String! @rateLimit(max: 10, window: 60000)
}
`,
resolvers: {
const updateAnItem = (root, args, ctx) => {
return Item.update({ name: args.name }).where({ id: args.id, userId: ctx.userId });
};
const updateAnItem = (root, args) => {
return Item.update({ name: args.name }).where({ id: args.id });
};
@kirkness
kirkness / my-schema.graphql
Last active January 6, 2019 20:00
Example authorised schema
type Query {
getMyData: Data @authenticate
somePublicData: String
}
type Mutation {
updateAnItem(id: ID!, name: String!): Item @authenticate
}
@kirkness
kirkness / apollo-engine-setup.ts
Created October 19, 2018 08:43
Example of problem where data is not reporting
const server = new ApolloServer({
formatError,
resolvers,
typeDefs: SCHEMA,
engine: false,
tracing: true,
cacheControl: true,
subscriptions: {
onConnect: authSubscription
@kirkness
kirkness / buildWhenAffected.sh
Created September 2, 2018 13:53 — forked from naesheim/buildWhenAffected.sh
CircleCi - only build features that has changed
##################
### config.yml ###
##################
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
steps: