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
| { | |
| "aw": { | |
| "name": "Aruba", | |
| "alpha-2": "AW", | |
| "alpha-3": "ABW", | |
| "country-code": "533", | |
| "iso_3166-2": "ISO 3166-2:AW", | |
| "region": "Americas", | |
| "sub-region": "Latin America and the Caribbean", | |
| "intermediate-region": "Caribbean", |
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
| sudo apt-get update | |
| sudo apt-get install -y ca-certificates curl gnupg unzip | |
| sudo install -m 0755 -d /etc/apt/keyrings | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
| sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
| $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | |
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
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
| let wQ = [0, 5]; | |
| let bQ = [5, 0]; | |
| let board = [ | |
| [0, 0, 0, 0, 0, 0, 0, 0], | |
| [0, 0, 0, 0, 0, 0, 0, 0], | |
| [0, 0, 0, 0, 0, 0, 0, 0], | |
| [0, 0, 0, 0, 0, 0, 0, 0], | |
| [0, 0, 0, 0, 0, 0, 0, 0], | |
| [0, 0, 0, 0, 0, 0, 0, 0], |
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 squareCode = function(message) { | |
| msg = message.replace(/ +/g, ''); | |
| let len = msg.length; | |
| let sqR = Math.ceil(Math.sqrt(len)); | |
| let rS = []; | |
| for (let r = 0; r < sqR; r++) { | |
| for (let i = 0; i < sqR; i++) { | |
| rS.push(msg[r + (i * sqR)]) | |
| } | |
| rS.push(' '); |
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 urlDecode = function(text) { | |
| text = text.replace(/%20/g, ' '); | |
| let strArray = text.split(/[(=)|(&)]+/); | |
| let results = {}; | |
| for (let i = 0; i < strArray.length; i += 2) | |
| results[strArray[i]] = strArray[i + 1]; | |
| return results | |
| }; | |
| console.log(urlDecode("duck=rubber")); |
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 makeCase = function (input, scheme) { | |
| (typeof scheme !== 'object') && (scheme = [scheme]); | |
| let arrStr = [input]; | |
| for (let sch of scheme){ | |
| let i = 0; | |
| let cap = false; | |
| for (let c of arrStr.join('')) { | |
| if (sch === 'camel') { | |
| c === ' ' ? cap = true : cap === true ? (arrStr[i] = c.toUpperCase()) && (cap = false) : arrStr[i] = c; | |
| i++; |
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
| // In this exercise, we will be given a list of instructors and we will create a single object to organize them based on their course. | |
| // Input | |
| const organizeInstructors = function(instructors) { | |
| let org = {}; | |
| for (const i of instructors) { | |
| org[i.course] ? org[i.course].push(i.name) : org[i.course] = [i.name]; | |
| } | |
| return org; |
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 calculateChange = function(total, cash) { | |
| // c(hange) | |
| let c = { | |
| twentyDollar : 0, | |
| tenDollar : 0, | |
| fiveDollar : 0, | |
| twoDollar : 0, | |
| oneDollar : 0, | |
| quarter : 0, | |
| dime : 0, |
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 talkingCalendar = function(date) { | |
| const dateArray = date.split('/'); | |
| const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | |
| let friendlyDate = {day : 0, month : '', year : 0}; | |
| friendlyDate.day = +dateArray[2] + (+dateArray[2] === 1 ? 'st' : (+dateArray[2] === 2 ? 'nd' : +dateArray[2] === 3 ? 'rd' : 'th')); | |
| friendlyDate.month = months[(+dateArray[1]) - 1]; | |
| friendlyDate.year = dateArray[0]; |
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 chooseRecipe = function(bakeryA, bakeryB, recipes) { | |
| let applicableRecipies = ''; | |
| for (let recipe of recipes) { | |
| let boolBakeryA = false; | |
| let boolBakeryB = false; | |
| for (let ingredient of recipe.ingredients) { | |
| bakeryA.includes(ingredient) && (boolBakeryA = true); | |
| bakeryB.includes(ingredient) && (boolBakeryB = true); | |
| } | |
| (boolBakeryA && boolBakeryB) && (applicableRecipies += recipe.name); |
NewerOlder