This file contains hidden or 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
| const wait = async (time) => { | |
| console.log(`Going to be waiting for ${time} seconds`) | |
| return new Promise((resolve) => { | |
| setTimeout(() => { | |
| console.log(`Done waiting for ${time} seconds!`) | |
| resolve() | |
| }, time * 1000) | |
| }) | |
| } |
This file contains hidden or 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
| const AWS = require('aws-sdk') | |
| const docClient = new AWS.DynamoDB.DocumentClient() | |
| const mapKeys = (input, transform) => { | |
| const output = {} | |
| Object.keys(input).forEach((key, index, array) => { | |
| output[transform(key, index, array)] = input[key] | |
| }) | |
| return output |
This file contains hidden or 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
| whateverId | attribute1 | someotherattribute | |
|---|---|---|---|
| foo | bar | baz | |
| hello | erwin | world |
This file contains hidden or 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'; | |
| /* | |
| * HTTP headers are case-insensitive. So 'Host' is a valid header, but so | |
| * is 'host' or 'hOst'. To make sure we don't miss a header we first lowerCase | |
| * all of them and then check for the lowercase version of the header | |
| */ | |
| const normaliseHeaders = (headers) => { | |
| const normalisedHeaders = {}; | |
| const fields = Object.keys(headers); |
This file contains hidden or 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'); | |
| request = request.defaults({agentOptions: {maxSocket: 1}, timeout: 1200}); | |
| for(i=0;i < 10;i++) { | |
| console.log("Requesting"); | |
| request.get("http://localhost:3000/", function(err, res, body) { | |
| if(err) { | |
| console.log(err); | |
| } |
This file contains hidden or 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
| redis = require('redis').createClient process.env['REDIS_PORT_6379_TCP_PORT'], process.env['REDIS_PORT_6379_TCP_ADDR'] | |
| redis.select 1 | |
| Twitter = require 'twitter' | |
| credentials = | |
| consumer_key: process.env.TWITTER_CONSUMER_KEY | |
| consumer_secret: process.env.TWITTER_CONSUMER_SECRET | |
| access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY | |
| access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET | |
| twitter = new Twitter credentials |