Skip to content

Instantly share code, notes, and snippets.

View MauriceWebb's full-sized avatar

Maurice Webb MauriceWebb

View GitHub Profile
@dabit3
dabit3 / SingleTableAppSync.md
Last active February 24, 2023 20:05
GraphQL Single Table Design with DynamoDB and AWS AppSync

GraphQL

GraphQL Schema

type Customer {
  id: ID!
  email: String!
}
@koingdev
koingdev / putitem-if-not-exist.vtl
Created July 22, 2019 09:41
AppSync Resolver PutItem with Condition Prevent Data Overwrite
{
"version" : "2017-02-28",
"operation" : "PutItem",
"key" : {
"shopID": $util.dynamodb.toDynamoDBJson($ctx.args.shopID),
"vendorID": $util.dynamodb.toDynamoDBJson($ctx.args.vendorID)
},
"attributeValues": {
"name": $util.dynamodb.toDynamoDBJson($ctx.args.name)
},
@shicholas
shicholas / AppSync.yaml
Created June 24, 2019 08:41
CloudFormation for Cognito & AppSync
---
AWSTemplateFormatVersion: '2010-09-09'
Description: >
This template creates an Authenticated AppSync API & Resolver Lambda
Parameters:
pGraphqlDefinition:
Description: GraphQL Schema
Type: String
pFunctionName:
Description: Name to Call the Function and Role
@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:
@schmod
schmod / README.md
Last active December 2, 2020 06:04
elasticsearch.js, Bluebird, and AWS Elasticsearch with TypeScript

A quick example demonstrating how to use elasticsearch.js, Bluebird, and AWS Elasticsearch with TypeScript.

You'll need to install a few dependencies and types:

npm install --save @types/elasticsearch @types/http-aws-es elasticsearch http-aws-es bluebird

If you're using AWS Elasticsearch, provide an ES_TYPE environment variable set to aws, as well as values for AWS_ACCESS_KEY, AWS_SECRET_KEY, and AWS_REGION. (I make this configurable so it's easy to point applications at a local ES instance when developing/testing locally, and at AWS when deployed to production)

/* webpack.config.js */
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
module.exports = {
// Tell Webpack which file kicks off our app.
entry: path.resolve(__dirname, 'src/index.js'),
// Tell Weback to output our bundle to ./dist/bundle.js
@chranderson
chranderson / nvmCommands.js
Last active June 20, 2024 16:47
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@brock
brock / nodereinstall.sh
Last active June 13, 2024 12:20
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@daviddefco
daviddefco / full_linkedin_profile
Last active August 15, 2021 01:33
Code to get access to both basic and full linkedin profiles. You make one execution with the first code block to get token and token secret values and then can remove this code, assign values to variables and get the access_token directly
require 'oauth'
# api_key and api_secret values are got from the registration of your application in LinkedIn:
# http://developer.linkedin.com/
api_key = 'Your API Key'
api_secret = 'Your API Secret'
# access_token and token_secret are known after the first execution code block
access_token = 'The token we get below'
token_secret = 'The token secret we get below'