From dfa6a00a99239a5704d82ed28014662c9493a306 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:20:52 -0700 Subject: [PATCH 01/46] add keydown listener --- 01 - JavaScript Drum Kit/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..8bd8c6b603 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,6 +58,10 @@ From a87f238361aa245ee8f179bec6810508f79b3f78 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:26:28 -0700 Subject: [PATCH 02/46] remove console.log --- 01 - JavaScript Drum Kit/index-START.html | 1 - 1 file changed, 1 deletion(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 8bd8c6b603..a58cdfa2bf 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -60,7 +60,6 @@ From cae53bbd18e9153dbca5a7dde42a4bf4de5911b9 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:29:37 -0700 Subject: [PATCH 03/46] add playing class on keydown --- 01 - JavaScript Drum Kit/index-START.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index a58cdfa2bf..e536973d75 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -60,6 +60,8 @@ From 77bdb1f02694937c22e89769d789039c98ff70aa Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:34:05 -0700 Subject: [PATCH 04/46] add sound and circuit breaker --- 01 - JavaScript Drum Kit/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index e536973d75..8bc28fef4f 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -61,6 +61,10 @@ window.addEventListener('keydown', function (e) { e.preventDefault(); const key = document.querySelector(`.key[data-key="${e.keyCode}"]`); + const sound = document.querySelector(`audio[data-key="${e.keyCode}"]`); + if (!sound) { + return + }; key.classList.add('playing'); }); From b4363f77d7afca9ac278a2c2f9ad1906a4ada058 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:35:22 -0700 Subject: [PATCH 05/46] add play method to sound --- 01 - JavaScript Drum Kit/index-START.html | 1 + 1 file changed, 1 insertion(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 8bc28fef4f..2eb4bcafcd 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -65,6 +65,7 @@ if (!sound) { return }; + sound.play(); key.classList.add('playing'); }); From 4527702bff2e38bf93dad6fffd7396e2e00242c6 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:36:05 -0700 Subject: [PATCH 06/46] fix sound repeat issue --- 01 - JavaScript Drum Kit/index-START.html | 1 + 1 file changed, 1 insertion(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 2eb4bcafcd..8a53d84423 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -65,6 +65,7 @@ if (!sound) { return }; + sound.currentTime = 0; sound.play(); key.classList.add('playing'); }); From d37ef348e6c839cfb8fa48745f2dd8ec94c189b8 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 9 Dec 2016 07:45:38 -0700 Subject: [PATCH 07/46] add key transition event listener --- 01 - JavaScript Drum Kit/index-START.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 8a53d84423..1f8acb822c 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,6 +58,11 @@ From 54bb1b480082ce432abe6aadce3af6f32adf7d42 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 07:49:49 -0700 Subject: [PATCH 11/46] add title --- 02 - JS + CSS Clock/index-START.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 259280d228..e26e4247a6 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -2,7 +2,7 @@ - Codestin Search App + Codestin Search App From c362d92c50ce8623d83dc66f7683d1be7cd5201d Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 07:59:45 -0700 Subject: [PATCH 12/46] add clock hands consts --- 02 - JS + CSS Clock/index-START.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index e26e4247a6..5c25b1f76e 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -66,6 +66,9 @@ From ee4eef9793a4dcb045ed0d998d262b975bf0b4c3 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 08:01:34 -0700 Subject: [PATCH 13/46] add setTime function capture current time in seconds, minutes, and hours --- 02 - JS + CSS Clock/index-START.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 5c25b1f76e..c41263921e 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -70,6 +70,14 @@ const minHand = document.querySelector('.min-hand'); const hourHand = document.querySelector('.hour-hand') + function setTime() { + // Store current time + const currentTime = new Date(); + const seconds = currentTime.getSeconds(); + const minutes = currentTime.getMinutes(); + const hours = currentTime.getMinutes(); + } + From f955db7ca383fb6b1f87c51b6b44fe0b83f11099 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 08:03:07 -0700 Subject: [PATCH 14/46] add hand positions to setTime --- 02 - JS + CSS Clock/index-START.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index c41263921e..cb6e9a41c8 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -76,6 +76,11 @@ const seconds = currentTime.getSeconds(); const minutes = currentTime.getMinutes(); const hours = currentTime.getMinutes(); + + // Calculate hand positions + const secondsPosition = (((seconds / 60) - 360) + 90); + const minutesPosition = (((minutes / 60) * 360) + 90); + const hoursPosition = (((minutes / 12) * 360) + 90); } From 6281b7d690b5192093ee79cfc72e4444e45a707a Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 08:05:38 -0700 Subject: [PATCH 15/46] add hand position setters --- 02 - JS + CSS Clock/index-START.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index cb6e9a41c8..2cb2ff0a9a 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -81,6 +81,11 @@ const secondsPosition = (((seconds / 60) - 360) + 90); const minutesPosition = (((minutes / 60) * 360) + 90); const hoursPosition = (((minutes / 12) * 360) + 90); + + // Set hand positions + secHand.style.transform = `rotate(${secondsPosition}deg)`; + minHand.style.transform = `rotate(${minutesPosition}deg)`; + hourHand.style.transform = `rotate(${hoursPosition}deg)`; } From 5c399a1cf653327febfb491ba3de736b74cfe1b7 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 08:07:42 -0700 Subject: [PATCH 16/46] add clock update timer --- 02 - JS + CSS Clock/index-START.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2cb2ff0a9a..ade243e33d 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -88,6 +88,8 @@ hourHand.style.transform = `rotate(${hoursPosition}deg)`; } + // Update clock each second + setInterval(setTime, 1000); From 71aa302e5f74e1ded8d2b4a817f668c823842757 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 08:32:25 -0700 Subject: [PATCH 17/46] fix seconds hand typo --- 02 - JS + CSS Clock/index-START.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index ade243e33d..552d128746 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -78,7 +78,7 @@ const hours = currentTime.getMinutes(); // Calculate hand positions - const secondsPosition = (((seconds / 60) - 360) + 90); + const secondsPosition = (((seconds / 60) * 360) + 90); const minutesPosition = (((minutes / 60) * 360) + 90); const hoursPosition = (((minutes / 12) * 360) + 90); From f5846a5b554e2a3a0f70ba1ca4675134a96720f3 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 10:04:57 -0700 Subject: [PATCH 18/46] fix hand position calculation --- 02 - JS + CSS Clock/index-START.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 552d128746..aaf140ebc4 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -73,14 +73,11 @@ function setTime() { // Store current time const currentTime = new Date(); - const seconds = currentTime.getSeconds(); - const minutes = currentTime.getMinutes(); - const hours = currentTime.getMinutes(); // Calculate hand positions - const secondsPosition = (((seconds / 60) * 360) + 90); - const minutesPosition = (((minutes / 60) * 360) + 90); - const hoursPosition = (((minutes / 12) * 360) + 90); + const secondsPosition = (((currentTime.getSeconds() / 60) * 360) + 90); + const minutesPosition = (((currentTime.getMinutes() / 60) * 360) + 90); + const hoursPosition = (((currentTime.getHours() / 12) * 360) + 90); // Set hand positions secHand.style.transform = `rotate(${secondsPosition}deg)`; From 04869fe758cb1aad29ecc27db14d67510f1dc76e Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 10:06:28 -0700 Subject: [PATCH 19/46] add css position transform for clock hands --- 02 - JS + CSS Clock/index-START.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index aaf140ebc4..35bb08a420 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,6 +61,8 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); } From 2ff8cd841c8b3ecb49880c0ca04c99b3fab111c4 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 10:07:44 -0700 Subject: [PATCH 20/46] add clock hand styles --- 02 - JS + CSS Clock/index-START.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 35bb08a420..45582a5428 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -63,6 +63,17 @@ top:50%; transform-origin: 100%; transform: rotate(90deg); + border-radius: 5px 5px; + } + + .hand.second-hand { + height: 3px; + background: red; + } + + .hand.hour-hand { + width: 35%; + margin-left: 45px; } From 3e54c4356733f261d56b88e0e68738713d903df4 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 10:45:12 -0700 Subject: [PATCH 21/46] add clock hand bounce --- 02 - JS + CSS Clock/index-START.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 45582a5428..88ebb37b7c 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -9,9 +9,9 @@
-
-
-
+
+
+
@@ -76,6 +76,12 @@ margin-left: 45px; } + .hand-bounce { + transition: all 0.05s; + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); + } + + From f7369b2f46b6d819c1ae21e2ba75d5bc8bb5875a Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 11:33:34 -0700 Subject: [PATCH 26/46] add effect change handler function --- 03 - CSS Variables/index-START.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 685216fbd2..ab67bbb205 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -71,6 +71,11 @@

Update CSS Variables with JS

From 8bc215de507c083bf7169d7d2ba47a85a2247109 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Mon, 12 Dec 2016 11:34:47 -0700 Subject: [PATCH 27/46] add event listeners --- 03 - CSS Variables/index-START.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index ab67bbb205..324d933950 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -70,12 +70,19 @@

Update CSS Variables with JS

From 41af6684874812acbe692b2c44b1181738ea64e3 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 11:54:15 -0700 Subject: [PATCH 28/46] add inventors age (1500's) filter --- 04 - Array Cardio Day 1/index-START.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 089352c8a6..424bf6fb18 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -27,6 +27,13 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const fifteenHundreds = inventors.filter(function (inventor) { + if (inventor.year >= 1500 && inventor.year <= 1600) { + return true; + }; + }); + + console.table(fifteenHundreds); // Array.prototype.map() // 2. Give us an array of the inventory first and last names From dab955c88ee8755a0c9b92e5163d44da1da54bac Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 11:56:16 -0700 Subject: [PATCH 29/46] add inventor full name map --- 04 - Array Cardio Day 1/index-START.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 424bf6fb18..2f61fb19dd 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -37,6 +37,11 @@ // Array.prototype.map() // 2. Give us an array of the inventory first and last names + const inventorFullNames = inventors.map(function (inventor) { + return `${inventor.first} ${inventor.last}`; + }); + + console.log(inventorFullNames); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest From d1d712e784c3d84f26466b35bd4658487348f532 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 11:57:47 -0700 Subject: [PATCH 30/46] add inventors sorted by birthdate --- 04 - Array Cardio Day 1/index-START.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 2f61fb19dd..43c7864ccc 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -45,6 +45,15 @@ // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const inventorsByBirthdate = inventors.sort(function (a, b) { + if (a.year > b.year) { + return 1; + } else { + return -1; + }; + }); + + console.table(inventorsByBirthdate); // Array.prototype.reduce() // 4. How many years did all the inventors live? From e250a2b18ef43f26cf9fb7d55a59e615be692e4e Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 11:59:22 -0700 Subject: [PATCH 31/46] add inventors count total years --- 04 - Array Cardio Day 1/index-START.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 43c7864ccc..7e053a4224 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -57,6 +57,11 @@ // Array.prototype.reduce() // 4. How many years did all the inventors live? + const inventorsTotalYears = inventors.reduce(function (total, inventor) { + return total + (inventor.passed - inventor.year); + }, 0); + + console.log(inventorsTotalYears); // 5. Sort the inventors by years lived From 024323cd8e43c329550b781a4c37165f43777131 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:00:59 -0700 Subject: [PATCH 32/46] add inventors sort by age --- 04 - Array Cardio Day 1/index-START.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 7e053a4224..fcd04ab2b1 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -64,6 +64,15 @@ console.log(inventorsTotalYears); // 5. Sort the inventors by years lived + const inventorsByAge = inventors.sort(function (a, b) { + if ((a.passed - a.year) < (b.passed - b.year)) { + return 1; + } else { + return -1; + }; + }); + + console.table(inventorsByAge); // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris From 1ef4cf9abdf03c8b38952fcd03a3ae67b0534b48 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:06:45 -0700 Subject: [PATCH 33/46] add paris boulevard 'de' filter --- 04 - Array Cardio Day 1/index-START.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index fcd04ab2b1..423c81b39a 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -76,7 +76,11 @@ // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris - + const deBoulevards = Array.from(document.querySelector('.mw-category').querySelectorAll('a')).map(function (link) { + return link.textContent; + }).filter(function (text) { + return text.includes('de'); + }); // 7. sort Exercise // Sort the people alphabetically by last name From fb7c9fa771f7761138fcadb49adb32977b193709 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:08:10 -0700 Subject: [PATCH 34/46] add people sort by last name --- 04 - Array Cardio Day 1/index-START.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 423c81b39a..5f3285bb15 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -84,6 +84,15 @@ // 7. sort Exercise // Sort the people alphabetically by last name + const peopleByLastName = people.sort(function (a, b) { + if ((a.split(', ')[0]) > (b.split(', ')[0])) { + return 1; + } else { + return -1; + }; + }); + + console.log(peopleByLastName); // 8. Reduce Exercise // Sum up the instances of each of these From 231c1468824078019e10d09f89b66a183d12c50d Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:10:08 -0700 Subject: [PATCH 35/46] add transport count --- 04 - Array Cardio Day 1/index-START.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 5f3285bb15..38b44dcd3a 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -97,6 +97,15 @@ // 8. Reduce Exercise // Sum up the instances of each of these const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; + const transportTypeCount = data.reduce(function (k, v) { + if (!k[v]) { + k[v] = 0; + }; + k[v]++; + return k; + }, {}); + + console.log(transportTypeCount); From 99668d6ac231116057fc2725aea8facf09f48053 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:50:09 -0700 Subject: [PATCH 36/46] add flexbox to panels --- 05 - Flex Panel Gallery/index-START.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..1103e32a66 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,7 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; } .panel { @@ -41,6 +42,11 @@ font-size: 20px; background-size:cover; background-position:center; + display: flex; + flex: 1; + justify-content: center; + align-items: center; + flex-direction: column; } From d776f13a94987ab58575cc2f9bf44b4d2cdef526 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:51:18 -0700 Subject: [PATCH 37/46] add flexbox to panel children --- 05 - Flex Panel Gallery/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 1103e32a66..86f6ad9156 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -60,6 +60,10 @@ margin:0; width: 100%; transition:transform 0.5s; + display: flex; + flex: 1 0 auto; + justify-content: center; + align-items: center; } .panel p { From 3291e4616bf7e9bc686cf9b95b9ae9299beb6fa8 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:52:42 -0700 Subject: [PATCH 38/46] add transform to panel children --- 05 - Flex Panel Gallery/index-START.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 86f6ad9156..ad33d37802 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -66,6 +66,14 @@ align-items: center; } + panel > *:first-child { + transform: translateY(-100%); + } + + panel > *:last-child { + transform: translateY(100%); + } + .panel p { text-transform: uppercase; font-family: 'Amatic SC', cursive; From a388f4947dc228e70fa246c5f083ef9c88b0639c Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:53:44 -0700 Subject: [PATCH 39/46] add transform reset --- 05 - Flex Panel Gallery/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index ad33d37802..5a563690af 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -74,6 +74,10 @@ transform: translateY(100%); } + .panel.open-active > *:first-child, .panel.open-active > *:last-child { + transform: translateY(0); + } + .panel p { text-transform: uppercase; font-family: 'Amatic SC', cursive; From 742c8be2cb03ce05c57e93280546ef1c542b31ed Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:54:08 -0700 Subject: [PATCH 40/46] add flex size to open panels --- 05 - Flex Panel Gallery/index-START.html | 1 + 1 file changed, 1 insertion(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 5a563690af..d3af26ad87 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -89,6 +89,7 @@ } .panel.open { + flex: 5; font-size:40px; } From a610f94305f4e7dc33bdda3e50b9cd0734ae823f Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:54:50 -0700 Subject: [PATCH 41/46] add panels nodelist --- 05 - Flex Panel Gallery/index-START.html | 1 + 1 file changed, 1 insertion(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index d3af26ad87..7318d815b1 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -130,6 +130,7 @@ From 587cfbd95028c132de067ec6096e165e197b13cb Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:55:28 -0700 Subject: [PATCH 42/46] add toggleOpen method --- 05 - Flex Panel Gallery/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 7318d815b1..f0df200c05 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -132,6 +132,10 @@ From fd3b44562099ec6968582aa418b46858c9337ebb Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:56:22 -0700 Subject: [PATCH 43/46] add click event listeners --- 05 - Flex Panel Gallery/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index f0df200c05..ac9f1ba421 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -136,6 +136,10 @@ this.classList.toggle('open'); } + panels.forEach(function (panel) { + panel.addEventListener('click', toggleOpen); + }); + From 34410da52c01ac3f80f7654ec66aa70b0cf93e97 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:57:16 -0700 Subject: [PATCH 44/46] add toggleActive method --- 05 - Flex Panel Gallery/index-START.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index ac9f1ba421..423172344b 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -136,6 +136,12 @@ this.classList.toggle('open'); } + function toggleActive() { + if (e.propertyName.includes('flex')) { + this.classList.toggle('open-active'); + }; + } + panels.forEach(function (panel) { panel.addEventListener('click', toggleOpen); }); From a7d2e4c3a15d441d36722a9918617e971268c736 Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 12:57:51 -0700 Subject: [PATCH 45/46] add transitionend event listener --- 05 - Flex Panel Gallery/index-START.html | 1 + 1 file changed, 1 insertion(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 423172344b..93ec6d0360 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -144,6 +144,7 @@ panels.forEach(function (panel) { panel.addEventListener('click', toggleOpen); + panel.addEventListener('transitionend', toggleActive); }); From 9b2209bba263f70d7655a7b75a940dd9c08573ce Mon Sep 17 00:00:00 2001 From: Jeff Kohrman Date: Fri, 16 Dec 2016 13:22:21 -0700 Subject: [PATCH 46/46] add type ahead functions --- 06 - Type Ahead/index-START.html | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..5588117aca 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,43 @@