/**
- Get cognito user attributes in Lambda
- Need to grant permission to Lambda through an IAM role:
*/
serverless.yml:
iamRoleStatements:| #!/bin/bash | |
| yum update -y | |
| yum install -y httpd24 php56 | |
| cd /home/ec2-user/ | |
| aws s3 cp 's3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm' . --region us-west-2 | |
| yum -y install codedeploy-agent.noarch.rpm | |
| chown -R root:www /var/www | |
| chmod 2775 /var/www |
| --- | |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Resources: | |
| myDynamoDBTable: | |
| Type: AWS::DynamoDB::Table | |
| Properties: | |
| AttributeDefinitions: | |
| - AttributeName: Album | |
| AttributeType: S | |
| - AttributeName: Artist |
| function humanReadable(seconds) { | |
| var readable = ["00", "00", "00"]; | |
| // TODO | |
| if (seconds > 359999 || seconds < 0) { | |
| console.log("exiting...") | |
| return; | |
| } | |
| var min = 60; //* 60 = 1 hour | |
| var hour = 3600; //* 24 = 1 day | |
| var day = 86400; // |
| function order(words){ | |
| /** | |
| * Your task is to sort a given string. | |
| * Each word in the string will contain a single number. | |
| * This number is the position the word should have in the result. | |
| * Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0). | |
| * If the input string is empty, return an empty string. The words in the input String will only contain valid consecutive numbers. | |
| * |
| // create all permutations of an input string and remove duplicates, if present | |
| function permutations(string) { | |
| var nums = Array.from(string); | |
| var permutations = []; | |
| function swap(a, b) { | |
| var tmp = nums[a]; | |
| nums[a] = nums[b]; |
| /** | |
| Given a string, remove any characters that are unique from the string. | |
| Example: | |
| input: "abccdefee" | |
| output: "cceee" | |
| */ |
| /** | |
| abcde" -> 0 # no characters repeats more than once | |
| "aabbcde" -> 2 # 'a' and 'b' | |
| "aabBcde" -> 2 # 'a' occurs twice and 'b' twice (`b` and `B`) | |
| "indivisibility" -> 1 # 'i' occurs six times | |
| "Indivisibilities" -> 2 # 'i' occurs seven times and 's' occurs twice | |
| "aA11" -> 2 # 'a' and '1' | |
| "ABBA" -> 2 # 'A' and 'B' each occur twice | |
| */ |
/**
*/
serverless.yml:
iamRoleStatements:| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> |