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
// Make the request using axios, a promise-based HTTP library | |
axios.get(weatherURL).then((response) => { | |
// Once the response is received, pull the different parameters we'll need and save them as variables | |
const tomorrow = response.data.daily.data[1]; | |
const high = Math.round(tomorrow.temperatureHigh); | |
const low = Math.round(tomorrow.temperatureLow); | |
const precip = Math.round(tomorrow.precipProbability * 100); | |
const summary = tomorrow.summary; |
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
exports.handler = (event, context, callback) => { | |
// Construct the URL to make weather forecast requests | |
const weatherURL = `https://api.darksky.net/forecast/${API_KEY}/${COORDS}?exclude=currently,minutely,hourly,flags`; | |
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'; | |
const AWS = require('aws-sdk'); | |
const SNS = new AWS.SNS(); | |
// In addition to the AWS SDK, we'll use axios to help make our requests | |
const axios = require('axios'); | |
// Make sure to define these environment variables in the template.yaml file | |
const API_KEY = process.env.API_KEY; | |
const COORDS = process.env.COORDS; |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": "sns:Publish", | |
"Resource": "*" | |
} | |
] |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Contact Form Microservice</title> | |
<style> | |
/* It's not pretty, but it'll do :) */ | |
input, | |
textarea { | |
display: block; | |
margin: 20px; |
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
fetch(lambdaRequest) | |
.then(response => { | |
window.location.replace('https://yoursite.com/success-page'); | |
}) | |
.catch(err => { | |
window.location.replace('https://yoursite.com/error-page'); | |
}); |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"iam:*", | |
"lambda:*", | |
"ses:*", |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Contact Form Microservice</title> | |
<style> | |
/* It's not pretty, but it'll do :) */ | |
input, | |
textarea { | |
display: block; | |
margin: 20px; |
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
# List of bands that have appeard on the Vans Warped Tour | |
# Scraped from https://en.wikipedia.org/wiki/List_of_Warped_Tour_lineups_by_year | |
# Possibly not a complete list but it's the best I got | |
3OH!3 | |
'68 | |
5606 | |
A+ Dropouts | |
Aaron West and the Roaring Twenties | |
Abriel |
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
region_map = { | |
“us-east-1”: {“32”: “ami-6411e20d”, “64”: "ami-7a11e213"}, | |
“us-west-2”: {“32”: “ami-c9c7978c”, “64”: "ami-cfc7978a"} | |
} | |
puts region_map[“us-east-1”]["32"] |