This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var AWS = require("aws-sdk"); //load any NPM dependency | |
console.log('Loading function'); | |
exports.handler = (event, context, callback) => { | |
//console.log('Received event:', JSON.stringify(event, null, 2)); | |
console.log('value1 =', event.key1); | |
console.log('value2 =', event.key2); | |
console.log('value3 =', event.key3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var docClient = new DOC.DynamoDB(); | |
var params = {}; | |
params.TableName = "accounts"; | |
params.Key = {accountId: event.accountId}; | |
params.AttributeUpdates = { | |
website: {PUT: "update", Value: event.website} | |
}; | |
docClient.updateItem(params, function (err, data) { | |
if (err) { | |
console.log(err, err.stack); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require("request"); | |
var readJSON = require("read-json"); | |
var writeFile = require("write"); | |
var googleIdToken = require("google-id-token"); | |
function getGoogleCerts(kid, callback) { | |
console.log("Checking cache for google certs"); | |
readJSON("/tmp/certs.json", function(error, cert){ | |
if (error) { | |
console.log("Cert not found, downloading from google"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load this script first: <script src="https://apis.google.com/js/api.js?onload=init"></script> | |
gapi.load('auth2', function() { | |
googleAuth = gapi.auth2.init({client_id: '<your-google-api-key>.apps.googleusercontent.com'}) | |
googleAuth.signIn({'scope': 'profile email'}) | |
}) | |
// this is a-sync, you should wait till you get the googleAuth object before continueing. | |
AWS.config.region = 'eu-west-1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* // call this from your package.json like: | |
"scripts": { | |
"build-static": "webpack && node lib/build-static.js" | |
} | |
*/ | |
var shell = require('shelljs') | |
shell.cp('-f', 'app/index.html', 'build/public/index.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: Instant | |
provider: | |
name: aws | |
runtime: nodejs4.3 | |
stage: prod | |
region: eu-west-1 | |
iamRoleARN: arn:aws:iam::XXXXXXXXXXX:role/Lambda-execution | |
package: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 class=”main-headline” data-txt=”homepage.headline” /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.initConfig({ | |
lambda_invoke: { | |
default: { | |
options: { | |
// Task-specific options go here. | |
file_name: "UpdateAccount.js" | |
} | |
} |