From 939b012dc49728bdd41087cd30b6d39b6c1a8f3c Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:10:49 +0100 Subject: [PATCH 01/13] 01 done --- 01 - JavaScript Drum Kit/index-START.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..000c558859 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,23 @@ From 7a84d42a678930083d3351927eef65f09450a15d Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:10:56 +0100 Subject: [PATCH 02/13] 02 done --- 02 - JS and CSS Clock/index-START.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index ee7eaefb1f..c4c63a2ea1 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -62,12 +62,34 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.5s; + transition-timing-function: ease-in-out; } From e330fa7b2bd9a3505f5a1fc81439b4eae9e8ba93 Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:11:02 +0100 Subject: [PATCH 03/13] 03 done --- 03 - CSS Variables/index-START.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index ca2b59d077..034a5693dd 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,7 +21,21 @@

Update CSS Variables with JS

From 80bc5db46e504f4c4f84b932b4eb4d29a8007c10 Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:11:09 +0100 Subject: [PATCH 04/13] 04 done --- 04 - Array Cardio Day 1/index-START.html | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index eec0ffc31d..6198672f70 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -31,28 +31,64 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const inventors_born_in_1500s = inventors.filter(i => i.year >= 1500 && i.year < 1600); + + console.table(inventors_born_in_1500s); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + const inventor_names = inventors.map(i => { + return {first: i.first, last: i.last} + }); + console.table(inventor_names); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const inventors_sorted = inventors.sort((a, b) => a.year - b.year); + + console.table(inventors_sorted); // Array.prototype.reduce() // 4. How many years did all the inventors live? + const all_years_lived = inventors.reduce((acc, val) => { + return acc + (val.passed - val.year); + }, 0); + console.log(all_years_lived); // 5. Sort the inventors by years lived + const all_inventors_sorted_by_lived = inventors.sort((a, b) => (a.passed - a.year) - (b.passed - b.year)); + + console.table(all_inventors_sorted_by_lived); + // 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 boulevards = ["Boulevards of Paris", "City walls of Paris", "Thiers wall", "Wall of Charles V", "Wall of Philip II Augustus", "City gates of Paris", "Haussmann's renovation of Paris", "Boulevards of the Marshals", "Boulevard Auguste-Blanqui", "Boulevard Barbès", "Boulevard Beaumarchais", "Boulevard de l'Amiral-Bruix", "Boulevard des Capucines", "Boulevard de la Chapelle", "Boulevard de Clichy", "Boulevard du Crime", "Boulevard Haussmann", "Boulevard de l'Hôpital", "Boulevard des Italiens", "Boulevard de la Madeleine", "Boulevard de Magenta", "Boulevard Montmartre", "Boulevard du Montparnasse", "Boulevard Raspail", "Boulevard Richard-Lenoir", "Boulevard de Rochechouart", "Boulevard Saint-Germain", "Boulevard Saint-Michel", "Boulevard de Sébastopol", "Boulevard de Strasbourg", "Boulevard du Temple", "Boulevard Voltaire", "Boulevard de la Zone"]; + const boulevards_with_de = boulevards.filter(b => b.indexOf('de') > -1); + console.log(boulevards_with_de); // 7. sort Exercise // Sort the people alphabetically by last name + const people_sorted = people.sort((a, b) => { + [a_last, a_first] = a.split(', '); + [b_last, b_first] = b.split(', '); + return a_last > b_last ? 1 : -1; + }); + console.log(people_sorted); // 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 transportation = data.reduce((obj, item) => { + if (!obj[item]) { + obj[item] = 0; + }; + obj[item]++; + return obj; + }, {}); + + console.log(transportation); From a444e477683d3ef2c553ba63d4bb55bbfdabd472 Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:11:17 +0100 Subject: [PATCH 05/13] 05 done --- 05 - Flex Panel Gallery/index-START.html | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 31c9167e16..72bcff0e22 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; + flex: 1; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; } @@ -54,8 +60,18 @@ margin:0; width: 100%; transition:transform 0.5s; + /*border: 1px solid red;*/ + 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; @@ -68,6 +84,7 @@ .panel.open { font-size:40px; + flex: 5; } @@ -102,7 +119,19 @@ From c53a588e0682ee9e57270273cb08fe9a80225eed Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:11:24 +0100 Subject: [PATCH 06/13] 06 done --- 06 - Type Ahead/index-START.html | 37 +++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..126ed365a4 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -15,8 +15,43 @@ From 1bbad3ea9290f6208319e2c7e03dc335e773dc14 Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 14:45:38 +0100 Subject: [PATCH 07/13] 07 done --- 07 - Array Cardio Day 2/index-START.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..c884307181 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -27,14 +27,36 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? // Array.prototype.every() // is everyone 19 or older? + const is_adult = people.some(person => { + const currentYear = (new Date()).getFullYear(); + return currentYear - person.year >= 19; + }); + console.log(is_adult); + + const is_all_adult = people.every(person => { + const currentYear = (new Date()).getFullYear(); + return currentYear - person.year >= 19; + }); + + console.log(is_all_adult); // 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 + const the_comment = comments.find(c => c.id === 823423); + console.log(the_comment); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const index = comments.findIndex(c => c.id === 823423); + const new_comments = [ + ...comments.slice(0, index), + ...comments.slice(index+1) + ]; + + console.table(new_comments); + From 9842c178746918434f18749cdab35fb076b4a822 Mon Sep 17 00:00:00 2001 From: Tamas Kadar Date: Sat, 11 Mar 2017 15:17:00 +0100 Subject: [PATCH 08/13] 08 done --- 08 - Fun with HTML5 Canvas/index-START.html | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..ff833558f7 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,63 @@