Skip to content

Instantly share code, notes, and snippets.

Marcel Panse marcelpanse

Block or report user

Report or block marcelpanse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View instant-optimizely.html
<h1 class=”main-headline” data-txt=”homepage.headline” />
View serverless.yml
service: Instant
name: aws
runtime: nodejs4.3
stage: prod
region: eu-west-1
iamRoleARN: arn:aws:iam::XXXXXXXXXXX:role/Lambda-execution
View build-static.js
/* // 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')
View cognito.js
// load this script first: <script src=""></script>
gapi.load('auth2', function() {
googleAuth = gapi.auth2.init({client_id: '<your-google-api-key>'})
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'
View authHelper.js
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");
View UpdateAccount.js
var docClient = new DOC.DynamoDB();
var params = {};
params.TableName = "accounts";
params.Key = {accountId: event.accountId};
params.AttributeUpdates = {
website: {PUT: "update", Value:}
docClient.updateItem(params, function (err, data) {
if (err) {
console.log(err, err.stack);
View Gruntfile.js
module.exports = function (grunt) {
lambda_invoke: {
default: {
options: {
// Task-specific options go here.
file_name: "UpdateAccount.js"
View hello_world.js
'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);
You can’t perform that action at this time.