Skip to content

Instantly share code, notes, and snippets.

View lanceharper's full-sized avatar

Lance Harper lanceharper

View GitHub Profile
//DynamoDB table with Primary Key "id" and each item has attributes "title" and "author
//If you have an item in the table that only has one of these attributes, the search will fail
//Use the below GraphQL schema:
type Post {
id: ID!
title: String!
author: String!
}
@adrianhall
adrianhall / AppSync-Example.yaml
Created April 13, 2018 16:01
An example CloudFormation template for AWS AppSync
---
Description: AWSAppSync DynamoDB Example
Resources:
GraphQLApi:
Type: "AWS::AppSync::GraphQLApi"
Properties:
Name: AWSAppSync DynamoDB Example
AuthenticationType: AWS_IAM
PostDynamoDBTableDataSource:
import { StyleSheet, View, Text, ActivityIndicator } from "react-native";
import Sizer from "react-native-size";
import {
VictoryChart,
VictoryLine,
VictoryTheme,
VictoryAxis,
VictoryContainer,
VictoryCursorContainer,
Line,
@vjeux
vjeux / x.md
Last active January 6, 2024 07:15
Ocaml / functional programming

I'm taking down this post. I just posted this as a side comment to explain a sentence on my latest blog post. This wasn't meant to be #1 on HN to start a huge war on functional programming... The thoughts are not well formed enough to have a huge audience. Sorry for all the people reading this. And please, don't dig through the history...

@sebmarkbage
sebmarkbage / Infrastructure.js
Last active June 2, 2024 08:51
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@stevenringo
stevenringo / reinvent-2017-youtube.md
Created December 3, 2017 23:01
Links to YouTube recordings of AWS re:Invent 2017 sessions

| Title | Description

@southpolesteve
southpolesteve / thoughts.md
Last active March 19, 2021 23:42
Random GraphQL+RDBMS+AWS Lambda Thoughts
  • GraphQL is awesome. I was not a fan at first, but I have since been converted. I wouldn't hesitate to use it for anything new. Its not perfect though.
  • Running on Lambda is pretty straight forward. We have our own custom code for that, but if I was starting fresh, I would use the Apollo GraphQL server. They have one that is designed to run on Lambda. I've played with it and it works well.
  • If your graphQL resolvers are talking directly to a DB, make sure to share connections between requests. One connection per lambda instance. If you spin up a new connection per request you will have a bad time. I guess this is generally true for not-graphql lambda things too.
  • You need dataloader. It will batch DB queries for you. It (or something like it) is pretty critical to making any graphQL setup performant. Or at least not overload your DB.
  • You proabably need to follow the Relay spec. We didn't d
@lelandrichardson
lelandrichardson / ensureShallowPurity.js
Created September 12, 2017 23:00
safer react-redux
/* eslint no-restricted-syntax:0 */
const hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowDifferences(a, b) {
const result = [];
if (a === b) {
return result;
}
@busypeoples
busypeoples / UIPattern.re
Last active January 28, 2019 15:31
Slaying a UI Anti Pattern in ReasonML
/*
Slaying a UI Anti Pattern in ReasonML
Based on Kris Jenkins original writing.
http://blog.jenkster.com/2016/06/how-elm-slays-a-ui-antipattern.html
*/
type remoteData 'e 'a =
| NotAsked
| Loading
| Failure 'e
| Success 'a;
import React, { Component, PropTypes } from 'react'
import {
Text,
View,
ScrollView
} from 'react-native'
import Redirect from 'react-router/Redirect'
import Match from 'react-router/Match'