From e127a2fcdf9fd75df78bf9c635f86fb70823ebc5 Mon Sep 17 00:00:00 2001 From: mrodrigues Date: Wed, 14 Dec 2016 20:55:57 -0200 Subject: [PATCH 1/4] Day 1 --- 01 - JavaScript Drum Kit/index-START.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..57fee280ff 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,28 @@ From 757e23add2688123fab52dc8e6d3be6945460831 Mon Sep 17 00:00:00 2001 From: mrodrigues Date: Wed, 14 Dec 2016 20:56:02 -0200 Subject: [PATCH 2/4] Day 2 --- 02 - JS + CSS Clock/index-START.html | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..c0fb18cbb2 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,13 +61,48 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: transform cubic-bezier(0.24, 0.7, 0.18, 2.42) 0.05s; } From 0f230625c8d2457e529f23c99d8dbab84cae896a Mon Sep 17 00:00:00 2001 From: mrodrigues Date: Thu, 15 Dec 2016 14:18:21 -0200 Subject: [PATCH 3/4] Day 3 --- 03 - CSS Variables/index-START.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..ed9a5d8db5 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,6 +21,21 @@

Update CSS Variables with JS

From a0e78d237216f78e72ff3cbd040883ea86e28675 Mon Sep 17 00:00:00 2001 From: mrodrigues Date: Fri, 16 Dec 2016 14:48:21 -0200 Subject: [PATCH 4/4] Day 4 --- 04 - Array Cardio Day 1/index-START.html | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 4162bce339..2db1d03728 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,29 +33,60 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const inventorsFromThe1500s = inventors.filter(inventor => inventor.year >= 1500 && inventor.year <= 1599) + console.table(inventorsFromThe1500s); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + const fullNames = inventors.map(inventor => `${inventor.first} ${inventor.last}`) + console.table(fullNames); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const sorted = [].concat(inventors).sort((a, b) => b.year - a.year); + console.table(sorted); // Array.prototype.reduce() // 4. How many years did all the inventors live? + const totalYearsOfScience = inventors.reduce((sum, inventor) => sum + lived(inventor), 0) + console.log(totalYearsOfScience); // 5. Sort the inventors by years lived + const oldest = [].concat(inventors).sort((a, b) => lived(b) - lived(a)); + console.table(oldest); // 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 boulevardsWithDe = Array.prototype.map.call( + document.querySelectorAll('.mw-category li a'), + anchor => anchor.textContent + ).filter(boulevard => boulevard.indexOf('de') !== -1); // 7. sort Exercise // Sort the people alphabetically by last name + const alphabeticallyOrdered = [].concat(people).sort((a, b) => lastName(a) > lastName(b) ? 1 : -1); + console.log(alphabeticallyOrdered); // 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 countsOfVehicles = data.reduce( + (hash, vehicle) => { + hash[vehicle] = (hash[vehicle] || 0) + 1; + return hash; + }, + {} + ); + console.log(countsOfVehicles); + + function lived(inventor) { + return inventor.passed - inventor.year; + } + function lastName(fullName) { + const [_, last] = fullName.split(', '); + return last; + }