From 838605bc5cb06f07f4b7326edf1e4b0f0d3ec847 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Sat, 21 Apr 2018 11:32:43 -0700 Subject: [PATCH 01/23] play audio on keypress --- 01 - JavaScript Drum Kit/index-START.html | 64 +++++++++++++---------- 01 - JavaScript Drum Kit/style.css | 2 + 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..d8819b7c7c 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -9,56 +9,64 @@
-
- A +
+ a clap
-
- S +
+ o hihat
-
- D +
+ e kick
-
- F +
+ u openhat
-
- G +
+ h boom
-
- H +
+ t ride
-
- J +
+ n snare
-
- K +
+ s tom
-
- L +
+ d tink
- - - - - - - - - + + + + + + + + + diff --git a/01 - JavaScript Drum Kit/style.css b/01 - JavaScript Drum Kit/style.css index 075578c930..1ff1151058 100644 --- a/01 - JavaScript Drum Kit/style.css +++ b/01 - JavaScript Drum Kit/style.css @@ -15,6 +15,8 @@ body,html { min-height: 100vh; align-items: center; justify-content: center; + flex-wrap: wrap; + align-content: center; } .key { From 5d3522c468b644392baac68804d72dca7b4b4cc6 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Sat, 21 Apr 2018 11:58:10 -0700 Subject: [PATCH 02/23] add and remove highlight on key --- 01 - JavaScript Drum Kit/index-START.html | 28 ++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index d8819b7c7c..4afa864575 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,15 +58,27 @@ From 4e15156621e2d9287b95805b50987143ce271d36 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Sat, 21 Apr 2018 15:20:01 -0700 Subject: [PATCH 03/23] rotate second hand --- 02 - JS and CSS Clock/index-START.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index ee7eaefb1f..b78a285f52 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -2,7 +2,7 @@ - JS + CSS Clock + JS + oooo CSS Clock @@ -62,12 +62,24 @@ background:black; position: absolute; top:50%; + transform: rotate(0deg); + transform-origin: 100%; } From ed5388761b04d3c6bcf213de49fc83190e95da9b Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Sat, 21 Apr 2018 15:42:06 -0700 Subject: [PATCH 04/23] rotate and animate all --- 02 - JS and CSS Clock/index-START.html | 31 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index b78a285f52..89268e42be 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -64,20 +64,41 @@ top:50%; transform: rotate(0deg); transform-origin: 100%; + transition: all 0.5s; + + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); + + } + + .second-hand { + height:2px; + } + + .hour-hand { + height:12px; } + From 0dc98236215dfe680ca0911669f60dd516b5c9ce Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Mon, 23 Apr 2018 11:28:32 -0700 Subject: [PATCH 07/23] array cardio --- 04 - Array Cardio Day 1/index-START.html | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index eec0ffc31d..47b20ae7a4 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -29,31 +29,53 @@ const people = ['Beck, Glenn', 'Becker, Carl', 'Beckett, Samuel', 'Beddoes, Mick', 'Beecher, Henry', 'Beethoven, Ludwig', 'Begin, Menachem', 'Belloc, Hilaire', 'Bellow, Saul', 'Benchley, Robert', 'Benenson, Peter', 'Ben-Gurion, David', 'Benjamin, Walter', 'Benn, Tony', 'Bennington, Chester', 'Benson, Leana', 'Bent, Silas', 'Bentsen, Lloyd', 'Berger, Ric', 'Bergman, Ingmar', 'Berio, Luciano', 'Berle, Milton', 'Berlin, Irving', 'Berne, Eric', 'Bernhard, Sandra', 'Berra, Yogi', 'Berry, Halle', 'Berry, Wendell', 'Bethea, Erin', 'Bevan, Aneurin', 'Bevel, Ken', 'Biden, Joseph', 'Bierce, Ambrose', 'Biko, Steve', 'Billings, Josh', 'Biondo, Frank', 'Birrell, Augustine', 'Black, Elk', 'Blair, Robert', 'Blair, Tony', 'Blake, William']; + const yearsLived = i => i.passed - i.year; + // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + console.log( inventors.filter( i => i.year > 1500 && i.year < 1600) ); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + console.log( inventors.map( i => [i.first, i.last])); + // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + console.log( inventors.sort( (a,b) => a.year - b.year )); + // Array.prototype.reduce() // 4. How many years did all the inventors live? + console.log( inventors.reduce( (acc, cur) => acc + yearsLived(cur), 0)); // 5. Sort the inventors by years lived + console.table( inventors + .sort((a,b) => yearsLived(b) - yearsLived(a)) + .map( i => [yearsLived(i), i.first, i.last].join(' ')) + ) // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris + // im skipping this; well understood - + const extractNameComponents = name => { + const [last, first] = name.split(','); + return { last, first }; + } // 7. sort Exercise // Sort the people alphabetically by last name + console.table( people + .map(extractNameComponents) + .sort( (a, b) => a.last > b.last ? 1 : -1) + ) + // 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' ]; + From 6a5bacb7362ad869e88465134a5f63c74471eb41 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Mon, 23 Apr 2018 12:36:53 -0700 Subject: [PATCH 08/23] Count instances of vehicle type in array using reduce --- 04 - Array Cardio Day 1/index-START.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 47b20ae7a4..bb00653b7c 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -73,8 +73,14 @@ // 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 data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck', 'moped' ]; + const counts = data.reduce( (acc, cur) => + // clone the accumulator so we avoid mutating the value + Object.assign({}, acc, { + [cur]: acc[cur] ? acc[cur] + 1 : 1 + }), {}); + + console.log( counts ); From 9646cbf2d195d255ec5dc6798080f5345eb03310 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Tue, 24 Apr 2018 11:56:00 -0700 Subject: [PATCH 09/23] flexbox panels getting static layout going --- 05 - Flex Panel Gallery/index-START.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index c6509bed02..fd378a11d4 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,14 +24,19 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; } .panel { + flex: 1; + display: flex; + flex-direction: column; + justify-content: center; + background:#6B0F9C; box-shadow:inset 0 0 0 5px rgba(255,255,255,0.1); color:white; text-align: center; - align-items:center; /* Safari transitionend event.propertyName === flex */ /* Chrome + FF transitionend event.propertyName === flex-grow */ transition: @@ -51,9 +56,14 @@ .panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); } .panel > * { + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; margin:0; width: 100%; transition:transform 0.5s; + border: 1px solid pink; } .panel p { From e8bc13b3a52f3e5c632800eb352163192304bd03 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Tue, 24 Apr 2018 15:10:45 -0700 Subject: [PATCH 10/23] open panel when clicked --- 05 - Flex Panel Gallery/index-START.html | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index fd378a11d4..f6e86150c5 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -71,13 +71,31 @@ font-family: 'Amatic SC', cursive; text-shadow:0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45); font-size: 2em; + transition:transform 0.5s; + } + + .panel :first-child { + border: aliceblue; + transform: translateY(-50%); + } + + .panel.open-active :first-child, + .panel.open-active :last-child { + transform: translateY(0%); + } + + .panel :last-child { + border: 2px solid darkgreen ; + transform: translateY(50%); } + .panel p:nth-child(2) { font-size: 4em; } .panel.open { font-size:40px; + flex: 5; } @@ -113,6 +131,16 @@ From adfaf87ec1ccde651c83b5c425400d39002742ee Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Tue, 24 Apr 2018 15:30:32 -0700 Subject: [PATCH 11/23] animate in other words when active. a little FP --- 05 - Flex Panel Gallery/index-START.html | 28 +++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index f6e86150c5..ff7e66f01b 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -63,7 +63,6 @@ margin:0; width: 100%; transition:transform 0.5s; - border: 1px solid pink; } .panel p { @@ -75,18 +74,16 @@ } .panel :first-child { - border: aliceblue; - transform: translateY(-50%); + transform: translateY(-100%); } - .panel.open-active :first-child, - .panel.open-active :last-child { + .panel.open.active :first-child, + .panel.open.active :last-child { transform: translateY(0%); } .panel :last-child { - border: 2px solid darkgreen ; - transform: translateY(50%); + transform: translateY(100%); } .panel p:nth-child(2) { @@ -131,14 +128,19 @@ From f5bd32ccdc81cd1fa6e4bcbb1f5281b07e4449a9 Mon Sep 17 00:00:00 2001 From: Benji Shine Date: Sat, 28 Apr 2018 12:10:40 -0700 Subject: [PATCH 12/23] add handlers for mousedown and up, draw in context a bit --- 08 - Fun with HTML5 Canvas/index-START.html | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..e6639e819a 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,28 @@