From 7cf7c3a499add13163b3ee1025a8d4fdbdf3dd00 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Wed, 17 Jan 2024 17:31:47 +0100 Subject: [PATCH 01/21] audio play while keydown --- 01 - JavaScript Drum Kit/index-START.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 8a2f8e8417..b760078fe6 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,7 +59,11 @@ From 8ad19b1c666cdc7c8d73ade9d04710aeabeca255 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Thu, 18 Jan 2024 11:47:43 +0100 Subject: [PATCH 02/21] adding new classes when keydown --- 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 b760078fe6..db07bfb603 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -62,7 +62,11 @@ window.addEventListener('keydown', event => { const audio = document.querySelector(`audio[data-key="${event.keyCode}"]`); if(!audio) return; // stop the function from running all together + audio.currentTime = 0; audio.play(); + const square = document.querySelector(`div[data-key="${event.keyCode}"]`); + if(!square) return; // stop the function from running all together + square.classList.add("playing"); }); From 47c07c7aa75ccb6ab4c2d3fa5380ca9bed00b268 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Thu, 18 Jan 2024 14:38:31 +0100 Subject: [PATCH 03/21] drum kit finished --- 01 - JavaScript Drum Kit/index-START.html | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index db07bfb603..05ab476841 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -61,13 +61,20 @@ From 79db70520bff62496f8cc51a98c8607b25e9a74d Mon Sep 17 00:00:00 2001 From: f1uffee Date: Thu, 18 Jan 2024 15:09:03 +0100 Subject: [PATCH 04/21] clock hand right placed --- 02 - JS and CSS Clock/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index 55ab1a5331..90b57cac05 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -63,6 +63,10 @@ background: black; position: absolute; top: 50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.05s; + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); } From 7d0c1bad184cec4bce49fcf6c0971802c4daf497 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Thu, 18 Jan 2024 15:31:59 +0100 Subject: [PATCH 05/21] js and css clock finished --- 02 - JS and CSS Clock/index-START.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index 90b57cac05..78d94124b5 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -72,8 +72,23 @@ From 3e29e0bc1f027313a10da1e2a18f01451f5f38ae Mon Sep 17 00:00:00 2001 From: f1uffee Date: Fri, 19 Jan 2024 12:21:44 +0100 Subject: [PATCH 06/21] css done --- 03 - CSS Variables/index-START.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index d5fcc3a2ae..a4b94495ed 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -13,7 +13,7 @@

Update CSS Variables with JS

- + @@ -22,6 +22,21 @@

Update CSS Variables with JS

From d581e0702ed1655aa26e12a4a144a7f1543abd32 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Fri, 19 Jan 2024 14:31:36 +0100 Subject: [PATCH 08/21] ex finished --- 03 - CSS Variables/index-START.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 3d173b0c7f..cd609c2549 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -61,12 +61,16 @@

Update CSS Variables with JS

From cfc45cd95500ccb4c30832e68da634dbb67bdd72 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Tue, 23 Jan 2024 12:20:14 +0100 Subject: [PATCH 09/21] 123 finished --- 04 - Array Cardio Day 1/index-START.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 0dcfd00f40..e91f90ea3e 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -38,12 +38,22 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const filterInventorsBirth = inventors.filter(function(inventor) { + return inventor.year > 1500 && inventor.year < 1600; + }); + console.log(filterInventorsBirth); // Array.prototype.map() // 2. Give us an array of the inventors first and last names + const inventorsFullName = inventors.map(({first,last}) => ([{first, last}])); + console.log(inventorsFullName) // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + let inventorsBirth = inventors.sort(function (a, b) { + return a.year - b.year; +}); + console.log(inventorsBirth) // Array.prototype.reduce() // 4. How many years did all the inventors live all together? From 874d8d2cf6afe2e398678f4289802748b72080a6 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Wed, 24 Jan 2024 16:33:47 +0100 Subject: [PATCH 10/21] ex finished --- 04 - Array Cardio Day 1/index-START.html | 42 ++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index e91f90ea3e..95bd42b7f5 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -39,38 +39,68 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's const filterInventorsBirth = inventors.filter(function(inventor) { - return inventor.year > 1500 && inventor.year < 1600; + return inventor.year >= 1500 && inventor.year < 1600; }); - console.log(filterInventorsBirth); + console.table(filterInventorsBirth); // Array.prototype.map() // 2. Give us an array of the inventors first and last names - const inventorsFullName = inventors.map(({first,last}) => ([{first, last}])); + const inventorsFullName = inventors.map(inventor => `${inventor.first} ${inventor.last}`); console.log(inventorsFullName) // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest let inventorsBirth = inventors.sort(function (a, b) { - return a.year - b.year; -}); - console.log(inventorsBirth) + return a.year - b.year; + }); + console.table(inventorsBirth) // Array.prototype.reduce() // 4. How many years did all the inventors live all together? + const totalYears = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(totalYears); // 5. Sort the inventors by years lived + const inventorsLived = inventors.sort(function (a, b) { + return (a.passed - a.year) > (b.passed - b.year) ? -1 : 1; + }); + console.table(inventorsLived) // 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 listBoulevards = document.querySelector('.mw-category'); + const links = [...listBoulevards.querySelectorALL('a')]; + const de = links + .map(link => link.textContent) + .filter(streetname => streetname.includes('de')); */ + // 7. sort Exercise // Sort the people alphabetically by last name + const peopleLastName = people.sort(function (lastOne, nextOne) { + const [aLast, aFirst] = lastOne.split(', '); + const [bLast, bFirst] = nextOne.split(', '); + return aLast > bLast ? 1 : -1; + }); + console.log(peopleLastName) // 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 sumInstanceOfData = data.reduce(function(object, item) { + console.log(object) + console.log(item) + if(!object[item]) { + object[item] = 0; + } + object[item]++; + return object; + }, {}); + console.log(sumInstanceOfData) From 3f7cb4df84367ce00af4fde5a2a415c0b21715ba Mon Sep 17 00:00:00 2001 From: f1uffee Date: Thu, 25 Jan 2024 15:04:09 +0100 Subject: [PATCH 11/21] ex finished --- 05 - Flex Panel Gallery/index-START.html | 36 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 88a4f1d1e2..05df91fbf4 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -27,6 +27,7 @@ .panels { min-height: 100vh; overflow: hidden; + display: flex; } .panel { @@ -38,12 +39,16 @@ /* Safari transitionend event.propertyName === flex */ /* Chrome + FF transitionend event.propertyName === flex-grow */ transition: - font-size 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), - flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), + font-size 0.1s , + flex 0.1s, background 0.2s; font-size: 20px; background-size: cover; background-position: center; + flex: 1; + justify-content: center; + display: flex; + flex-direction: column; } .panel1 { background-image:url(https://source.unsplash.com/gYl-UtwNg_I/1500x1500); } @@ -52,13 +57,23 @@ .panel4 { background-image:url(https://source.unsplash.com/ITjiVXcwVng/1500x1500); } .panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); } - /* Flex Children */ + /* Flex items */ .panel > * { margin: 0; width: 100%; transition: transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; } + .panel > *:first-child { transform: translateY(-100%); } + .panel.open-active > *:first-child { transform: translateY(0); } + .panel > *:last-child { transform: translateY(100%); } + .panel.open-active > *:last-child { transform: translateY(0); } + + .panel p { text-transform: uppercase; font-family: 'Amatic SC', cursive; @@ -72,6 +87,7 @@ .panel.open { font-size: 40px; + flex: 5; } @@ -106,6 +122,20 @@ From 09d1f922eed76453b92d2925431c886b7326d894 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Mon, 29 Jan 2024 15:22:14 +0100 Subject: [PATCH 12/21] ex finished --- 06 - Type Ahead/index-START.html | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 5a9aa7e4e8..f751acd4c9 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -18,6 +18,41 @@ From 331f6b85c3217ea38f3d315819e9ad57875ed9e2 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Tue, 30 Jan 2024 16:03:41 +0100 Subject: [PATCH 13/21] two first questions resolved --- 07 - Array Cardio Day 2/index-START.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 4ca34c7536..dd2e4e4e03 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -27,8 +27,21 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? - // Array.prototype.every() // is everyone 19 or older? + function isNinteenOrOlder(el, indice, array) { + return el >= 19 + } + + const ageOfPeople = people.map(age => { + return new Date().getFullYear() - age.year + }) + const resultOne = ageOfPeople.some(isNinteenOrOlder); + console.log(resultOne); + + // Array.prototype.every() // is everyone 19 or older? + const resultTwo = ageOfPeople.every(isNinteenOrOlder); + console.log(resultTwo); + // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 From ad94bb14c84a8c77ef13bde4f89302e56159ce97 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Wed, 31 Jan 2024 11:02:46 +0100 Subject: [PATCH 14/21] ex finished --- 07 - Array Cardio Day 2/index-START.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index dd2e4e4e03..f723016533 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -45,11 +45,17 @@ // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 + findComment = comments.find((el) => el.id === 823423); + console.log(findComment); // Array.prototype.findIndex() // Find the comment with this ID - // delete the comment with the ID of 823423 + const isId = (el) => el.id == 823423; + console.log(comments.findIndex(isId)); + // delete the comment with the ID of 823423 + deleteComment = comments.splice(comments.findIndex(isId),1); + console.table(comments); From 12a6eafd2577a19e9248229d31e74e12bc09e5f7 Mon Sep 17 00:00:00 2001 From: f1uffee Date: Wed, 31 Jan 2024 14:55:48 +0100 Subject: [PATCH 15/21] ex finished --- 08 - Fun with HTML5 Canvas/index-START.html | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index f70ad2059b..290936b4c8 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -8,6 +8,57 @@