From b7d2b71061576d9bf936783e05c6b92615616acd Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Wed, 14 Dec 2016 12:25:20 +0100 Subject: [PATCH 01/10] done style and drum JS --- 01 - JavaScript Drum Kit/index-START.html | 20 ++++++++++++++++++++ 01 - JavaScript Drum Kit/style.css | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..2f807eadb5 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,26 @@ diff --git a/01 - JavaScript Drum Kit/style.css b/01 - JavaScript Drum Kit/style.css index 3e0a320b37..175e648535 100644 --- a/01 - JavaScript Drum Kit/style.css +++ b/01 - JavaScript Drum Kit/style.css @@ -1,6 +1,6 @@ html { font-size: 10px; - background:url(http://i.imgur.com/b9r5sEL.jpg) bottom center; + background:url(https://chorus.fm/wp-content/uploads/2016/04/fleetfoxes.jpg) bottom center; background-size: cover; } body,html { From 4b64d1aa80fde41aaa829d747a36450e8553e689 Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Wed, 14 Dec 2016 16:54:26 +0100 Subject: [PATCH 02/10] done clock completely --- 02 - JS + CSS Clock/Memo.txt | 12 ++++++++++ 02 - JS + CSS Clock/index-START.html | 33 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 02 - JS + CSS Clock/Memo.txt diff --git a/02 - JS + CSS Clock/Memo.txt b/02 - JS + CSS Clock/Memo.txt new file mode 100644 index 0000000000..67c2d7cc85 --- /dev/null +++ b/02 - JS + CSS Clock/Memo.txt @@ -0,0 +1,12 @@ +1. CSS clock hand: + - use transform: rotate() in CSS file + - by default the object rotates in the middle of the object: use transform-origin: x%; to move the origin on the X axis. + - set default rotate at 90° to have them face upwards + - set a transition for the animation not to be too hard: transition: all 0.5s; + - use a transition-timing-funtion to update the way the object moves + +2. JS: + - setInterval to set the interval at which the hands should move + - A function to set the date. You have a date you find which second you are currently in then you transform into degress (make sure that you add 90° to the total because we added that to the CSS) + - then you add the style transform rotate by variable degrees. + diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..800714a701 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,11 +61,44 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.1s; + transition-timing-function: cubic-bezier(0.54, 2.52, 0.96, 1.09); } From 44862afab506dcb7082aad3cb5217ea2973588f0 Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Wed, 14 Dec 2016 19:02:00 +0100 Subject: [PATCH 03/10] corrected error on hour --- 02 - JS + CSS Clock/index-START.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 800714a701..0b0a5455a3 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -90,17 +90,13 @@ // HOUR var hour = date.getHours(); - var hourDegrees = ((hour / 24) * 360) + 90; + var hourDegrees = ((hour / 12) * 360) + 90; hour_hand.style.transform = `rotate(${hourDegrees}deg)`; } - - window.setInterval(setDate, 1000); - - From 91f6702a63b0f5ee69a83384e51b4486bce575a2 Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Mon, 19 Dec 2016 06:49:09 -0400 Subject: [PATCH 04/10] done exo --- 03 - CSS Variables/index-START.html | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..6b9326d615 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -22,9 +22,21 @@

Update CSS Variables with JS

+ From b8ccd2ebcac9e214e90de3e4c98259ef8a0189f0 Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Tue, 20 Dec 2016 06:58:28 -0400 Subject: [PATCH 05/10] done --- 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..852e0d6afc 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,28 +33,59 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + let fiteen = inventors.filter(inventor => inventor.year >= 1500 && inventor.year < 1600); + console.table(fiteen); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + let fullNames = inventors.map(inventor => inventor.first + " " + inventor.last); + console.log(fullNames); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + let ordered = inventors.sort((a, b) => a.year > b.year ? 1 : -1); + console.table(ordered); // Array.prototype.reduce() // 4. How many years did all the inventors live? + const yearsLived = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(yearsLived); // 5. Sort the inventors by years lived + const orderLife = inventors.sort((a, b) => { + const aLife = a.passed - a.year; + const bLife = b.passed - b.year; + (aLife > bLife) ? -1 : 1; + }); + console.table(orderLife); // 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 = [... document.querySelectorAll('.mw-category a')] + // let result = boulevards.map(boulevard => boulevard.textContent).filter(boulevard => boulevard.includes(`Boulevard de`)) // 7. sort Exercise // Sort the people alphabetically by last name + let sorted = people.sort((lastOne, nextOne) => { + const [aLast, aFirst] = lastOne.split(`, `); + const [bLast, bFirst] = nextOne.split(`, `); + return aLast < bLast ? -1 : 1 ; + }); + console.log(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 count = data.reduce((obj, item) => { + if (!obj[item]) { + obj[item] = 0; + } + obj[item]++; + return obj; + }, {}); + console.log(count); From 4d209dabde398df2c4030c2d4b24f71a0d1354a1 Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Tue, 20 Dec 2016 13:28:52 -0400 Subject: [PATCH 06/10] done --- 05 - Flex Panel Gallery/index-START.html | 38 +++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..dac9f1bcbb 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; + display: flex; + text-align: center; + justify-content: center; + flex-direction: column; } @@ -54,6 +60,10 @@ margin:0; width: 100%; transition:transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; } .panel p { @@ -66,7 +76,23 @@ font-size: 4em; } + .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.open { + flex: 5; font-size:40px; } @@ -107,7 +133,17 @@ From 60f8a2f5e5c4495a443ec86ea579a09f747f43ca Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Wed, 21 Dec 2016 12:30:40 -0400 Subject: [PATCH 07/10] done --- 06 - Type Ahead/index-START.html | 47 +++++++++++++++++++++++++++++++- 06 - Type Ahead/style.css | 4 +-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..a454e9a3e9 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -15,7 +15,52 @@ diff --git a/06 - Type Ahead/style.css b/06 - Type Ahead/style.css index 36dc55f30e..42badccd7a 100644 --- a/06 - Type Ahead/style.css +++ b/06 - Type Ahead/style.css @@ -38,8 +38,8 @@ margin: 0; padding: 0; position: relative; - /*perspective:20px;*/ - } +/* perspective:20px; +*/ } .suggestions li { background:white; list-style: none; From 0b5c71d0045b5d8f770096a53cfe40fb0055f678 Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Wed, 21 Dec 2016 13:35:40 -0400 Subject: [PATCH 08/10] done --- 07 - Array Cardio Day 2/index-START.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..24aa373f02 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,36 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? + const isAdult = people.some(person => { + let date = (new Date()).getFullYear(); + let age = date - person.year; + return age >= 19; + }); + console.log(isAdult); // Array.prototype.every() // is everyone 19? + const allAdults = people.every(person => { + let date = (new Date()).getFullYear(); + let age = date - person.year; + return age >= 19; + }); + console.log(allAdults); + // 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 idcheck = comments.find(comment => (comment.id === 823423)); + console.log(idcheck); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const findDelete = comments.findIndex(comment => (comment.id === 823423)); + console.table(comments); + comments.splice(findDelete, 2); + console.table(comments); + + From 9464094a5339ecd73151961116b2d92309cd88ad Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Wed, 21 Dec 2016 13:36:29 -0400 Subject: [PATCH 09/10] done --- 07 - Array Cardio Day 2/index-START.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 24aa373f02..9956c61617 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -52,7 +52,7 @@ // delete the comment with the ID of 823423 const findDelete = comments.findIndex(comment => (comment.id === 823423)); console.table(comments); - comments.splice(findDelete, 2); + comments.splice(findDelete, 1); console.table(comments); From 38b96b61377ac1955d2bce3f4f75d4c43019140c Mon Sep 17 00:00:00 2001 From: Romain Richard Date: Fri, 23 Dec 2016 10:35:09 -0400 Subject: [PATCH 10/10] done --- .../index-START.html | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/10 - Hold Shift and Check Checkboxes/index-START.html b/10 - Hold Shift and Check Checkboxes/index-START.html index eb7ed310bb..4c5fdcacea 100644 --- a/10 - Hold Shift and Check Checkboxes/index-START.html +++ b/10 - Hold Shift and Check Checkboxes/index-START.html @@ -104,6 +104,41 @@