Skip to content

Instantly share code, notes, and snippets.

@Ninir
Ninir / aws-api-gw-lambda-post-root-resource.md
Created August 4, 2016 16:37
Create an AWS API Gateway with a POST method on the root resource targetting a given Lambda

Description

This helps creating an AWS API GW with a POST method on the root resource (i.e /) targetting a given Lambda.

The current Terraform documentation is exposing a Mock integration. Thus, a few options are missing when wanting to expose a Lambda integration instead.

There are a few things to know:

1. Add the integration HTTP Method

First of all, you will need to add the integration_http_method alongside the http_method, as in:

@Ninir
Ninir / DynamoDBArn.json
Created December 21, 2015 11:04
Get the ARN of a DynamoDB table created in a CloudFormation stack
{
...
"Fn::Join": [
"",
[
"arn:aws:dynamodb:",
{
"Ref": "AWS::Region"
},
@Ninir
Ninir / gist:1736921
Created February 4, 2012 10:16
jQuery get elements currently in view
function isScrolledIntoView(elem)
{
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom));
}