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
| 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
| 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
| <!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
| {"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
| {"index.js":"function convertToRoman(num) {\n\n var decVal = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ];\n var romanVal = [ 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I' ];\n\n var romanized = '';\n\n for (var index = 0; index < decVal.length; index++) {\n while (decVal[index] <= num) {\n romanized += romanVal[index];\n num -= decVal[index];\n }\n }\n\n return romanized;\n }\n\nconvertToRoman(36);"} |
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 palindrome(str) {\n return str.replace(/[\\W_]/g, '').toLowerCase() ===\n str.replace(/[\\W_]/g, '')\n .toLowerCase()\n .split('')\n .reverse()\n .join('');\n}\n\npalindrome(\"eye\");"} |
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":"\nvar denominations = [\n { name: 'ONE HUNDRED', val: 100.00},\n { name: 'TWENTY', val: 20.00},\n { name: 'TEN', val: 10.00},\n { name: 'FIVE', val: 5.00},\n { name: 'ONE', val: 1.00},\n { name: 'QUARTER', val: 0.25},\n { name: 'DIME', val: 0.10},\n { name: 'NICKEL', val: 0.05},\n { name: 'PENNY', val: 0.01}\n];\n\nfunction checkCashRegister(price, cash, cid) {\n var result = { status: null, change: [] };\n var change = cash - price;\n\n var register = cid.reduce(function(acc, curr) {\n acc.total += curr[1];\n acc[curr[0]] = curr[1];\n return acc;\n }, { total: 0 });\n\n if (register.total === change) {\n result.status = 'CLOSED';\n result.change = cid;\n return result;\n }\n\n // Handle obvious insufficient funds\n if (register.total < change) {\n result.status = 'INSUFFICIENT_FUNDS';\n return result;\n }\n\n var change_arr = denominations.reduce(function(acc, curr) {\n var value = 0;\n \n while (register[curr.name] > 0 && change >= curr.val) { |
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 rot13(str) { // LBH QVQ VG!\n return str.split('')\n .map.call(str, function(char) {\n \n let x = char.charCodeAt(0);\n \n if (x < 65 || x > 90) { \n return String.fromCharCode(x);\n } else if (x < 78) { \n return String.fromCharCode(x + 13); \n }\n \n return String.fromCharCode(x - 13);\n }).join(''); \n}\n\n// Change the inputs below to test\nrot13(\"SERR PBQR PNZC\");"} |
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 square_root(num): | |
| return num ** 0.5 |