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
| {"index.js":"function telephoneCheck(s) {\n var reg = /^(1\\s?)?(\\(\\d{3}\\)|\\d{3})[\\s\\-]?\\d{3}[\\s\\-]?\\d{4}$/;\n return reg.test(s);\n}\n\ntelephoneCheck(\"555-555-5555\");"} |
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> | |
| <meta charset="UTF-8" /> | |
| </head> | |
| <body> | |
| <div> | |
| <form method="POST" action="/form"> | |
| <label>Name</label><input name="name" type="text" value="" /> | |
| <label>Address</label><input name="address" type="text" value="" /> |
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
| function success() { | |
| const data = JSON.parse(this.responseText); | |
| console.log(data); | |
| } | |
| function error(err) { | |
| console.log('Request Error', 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
| def leap_year(y): | |
| if y % 400 == 0: | |
| return True | |
| if y % 100 == 0: | |
| return False | |
| if y % 4 == 0: | |
| return True | |
| else: | |
| return False |
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
| npm install aws-sdk |
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
| # Dictionary of roman numbers to their integer equivalent | |
| ROMAN_NUMERALS = { 'I' : 1, 'V' : 5, 'X' : 10, 'L' : 50, 'C' : 100, 'D' : 500, 'M' : 1000 } | |
| # to_integer, takes in a string that represent a roman number, and | |
| # returns its integer equivalent | |
| def to_integer(roman): | |
| result = 0 | |
| # for every roman character passed, it N + 1 is greater/equal then the |
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
| async function createItem () { | |
| const createdUpdated = (new Date()).getTime(); | |
| let params = { | |
| TableName: tableName, | |
| Item: { | |
| 'userId': 'userId', | |
| 'createdAt': createdUpdated, | |
| 'updatedAt': createdUpdated | |
| } | |
| } |
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
| async function scan(table) { | |
| try { | |
| let result = await ddb.scan({ TableName: table }).promise() | |
| console.log(result); | |
| } catch (err) { | |
| console.error(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
| /* reverse: reverse string s in place */ | |
| void reverse(char s[]) | |
| { | |
| int i, j; | |
| char c; | |
| for (i = 0, j = strlen(s)-1; i<j; i++, j--) { | |
| c = s[i]; | |
| s[i] = s[j]; | |
| s[j] = c; |
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
| Get Item from DynamoDb Table | |
| async function getItem(tableName, key, value) { | |
| const params = { | |
| TableName: tableName, | |
| Key: { | |
| key: value | |
| } | |
| } |