From af69c2c8d2d20ade7cd155e8b56e7ec1900c9c81 Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Fri, 16 Jun 2017 11:43:21 +0100 Subject: [PATCH 1/9] Drum Kit update --- 01 - JavaScript Drum Kit/index-START.html | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..c2fd534db3 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,35 @@ From 5937fa9b73c50b92585371a5545fb7cba3e34e0b Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Mon, 19 Jun 2017 15:04:18 +0100 Subject: [PATCH 2/9] clock script added --- 02 - JS and CSS Clock/index-START.html | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index ee7eaefb1f..450559f0d8 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -62,12 +62,42 @@ 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 0bc7b949be7f67ac82222a85ec40978420ecea82 Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Mon, 19 Jun 2017 15:36:36 +0100 Subject: [PATCH 3/9] add styling to the clock --- 02 - JS and CSS Clock/index-START.html | 29 +++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index 450559f0d8..776afec40a 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -68,6 +68,22 @@ transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); } + .hour-hand { + width: 35%; + left:15%; + } + .min-hand { + width: 45%; + left:5%; + } + .second-hand { + background: red; + height: 3px; + } + .fast { + transition: all 0s; + } + From 985934726edcaa6e0c8bac0d13537a8846d34a33 Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Fri, 23 Jun 2017 09:45:23 +0100 Subject: [PATCH 5/9] array cardio 1st go --- 04 - Array Cardio Day 1/index-START.html | 78 +++++++++++++++++++++++- 1 file changed, 77 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..5284820792 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -31,29 +31,105 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + // const fifteen = inventors.filter(function(inventor) { + // if (inventor.year >= 1500 && inventor.year < 1600) { + // return true; //keep it + // } + // }); + + //alternative way + const fifteen = inventors.filter(inventor => (inventor.year >= 1500 && inventor.year < 1600)); + console.table(fifteen); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + // const names = inventors.map(function(inventor) { + // return inventor.first + " " + inventor.last; + // }); + // console.log(names); + + //alternative way with es6 template strings + const fullName = inventors.map(inventor => `${inventor.first} ${inventor.last}`); + console.log(fullName); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + // const oldest = inventors.sort(function(a, b) { + // return a.year - b.year; + // }); + const oldest = inventors.sort((a, b) => a.year - b.year); + console.table(oldest); // Array.prototype.reduce() - // 4. How many years did all the inventors live? + // 4. How many years did all the inventors live? + // const years = inventors.reduce(function(total, inventor) { + // return total + (inventor.passed - inventor.year); + // }, 0); + + const years = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(years); // 5. Sort the inventors by years lived + const yearsLived = inventors.sort(function(a, b) { + const firstInventor = a.passed - a.year; + const lastInventor = b.passed - b.year; + return lastInventor - firstInventor; + }); + console.table(yearsLived); // 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 listItems = Array.from(document.querySelectorAll('.mw-category a')); + // const de = listItems + // .map(function(link) { + // return link.textContent; + // }) + // .filter(function(item) { + // return item.indexOf('de') > -1; + // }); + //es6 way + const listItems = Array.from(document.querySelectorAll('.mw-category a')); + const de = listItems + .map(link => link.textContent) + .filter(item => item.includes('de')); // 7. sort Exercise // Sort the people alphabetically by last name + const names = people.sort((a,b) => { + const [aLast, aFirst] = a.split(','); + const [bLast, bFirst] = b.split(','); + return aLast > bLast ? 1 : -1; + }); + console.log(names); // 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 vehicle = data.reduce(function(allNames, name) { + if(name in allNames) { + allNames[name]++; + } else { + allNames[name] = 1; + } + return allNames; + }, {}); + console.log(vehicle); + + //alternative way + const transportation = data.reduce((obj, item) => { + if (!obj[item]) { + obj[item] = 0; + } + obj[item]++; + return obj; + }, {}); + + console.log(transportation); + From 6bc11f9f2343e9e8c37f57c65136c11b7f43c65e Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Fri, 23 Jun 2017 15:22:23 +0100 Subject: [PATCH 6/9] redo the array functions --- 04 - Array Cardio Day 1/index-START-2.html | 134 +++++++++++++++++++++ 04 - Array Cardio Day 1/index-START.html | 2 +- 05 - Flex Panel Gallery/index-START.html | 31 +++++ 3 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 04 - Array Cardio Day 1/index-START-2.html diff --git a/04 - Array Cardio Day 1/index-START-2.html b/04 - Array Cardio Day 1/index-START-2.html new file mode 100644 index 0000000000..6310c37d8c --- /dev/null +++ b/04 - Array Cardio Day 1/index-START-2.html @@ -0,0 +1,134 @@ + + + + + Array Cardio 💪 + + + + + + diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 5284820792..1c29a29306 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -75,7 +75,7 @@ const yearsLived = inventors.sort(function(a, b) { const firstInventor = a.passed - a.year; const lastInventor = b.passed - b.year; - return lastInventor - firstInventor; + return firstInventor > lastInventor ? -1 : 1; }); console.table(yearsLived); diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 31c9167e16..d7e0d21620 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,8 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; + /*flex-direction: column;*/ } .panel { @@ -41,6 +43,10 @@ font-size: 20px; background-size:cover; background-position:center; + flex:1; + display: flex; + flex-direction: column; + justify-content: center; } @@ -54,8 +60,17 @@ margin:0; width: 100%; transition:transform 0.5s; + display: flex; + justify-content: center; + align-items: center; + flex:1 0 auto; } + .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; @@ -67,6 +82,7 @@ } .panel.open { + flex: 5; font-size:40px; } @@ -103,6 +119,21 @@ From 0412cee4048600aca1f3dcedf49a3b73ba12bbb0 Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Mon, 26 Jun 2017 12:19:32 +0100 Subject: [PATCH 7/9] search functionality added with api --- 06 - Type Ahead/index-FINISHED.html | 1 + 06 - Type Ahead/index-START.html | 66 ++++++++++++++++++++++++++++- 06 - Type Ahead/style.css | 2 +- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/06 - Type Ahead/index-FINISHED.html b/06 - Type Ahead/index-FINISHED.html index 5902b43936..a047c594ba 100644 --- a/06 - Type Ahead/index-FINISHED.html +++ b/06 - Type Ahead/index-FINISHED.html @@ -30,6 +30,7 @@ }); } +console.log(cities) function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..d22da13d69 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -8,14 +8,76 @@
- +
  • Filter for a city
  • or a state
+
diff --git a/06 - Type Ahead/style.css b/06 - Type Ahead/style.css index 9a985bb5b3..e8980affb6 100644 --- a/06 - Type Ahead/style.css +++ b/06 - Type Ahead/style.css @@ -1,6 +1,6 @@ html { box-sizing: border-box; - background:#ffc600; + //background:#ffc600; font-family:'helvetica neue'; font-size: 20px; font-weight: 200; From e53a16cd751b958f88507a1bd21d9ee5ab8258a9 Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Mon, 26 Jun 2017 14:47:54 +0100 Subject: [PATCH 8/9] update the arrays --- 07 - Array Cardio Day 2/index-START.html | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..be88f00705 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -5,7 +5,7 @@ Array Cardio 💪💪 -

Psst: have a look at the JavaScript Console 💁

+ From 88b1672a0c9155e120e66833eafd5f8edb836ee1 Mon Sep 17 00:00:00 2001 From: Nikki Byrne Date: Thu, 6 Jul 2017 16:11:38 +0100 Subject: [PATCH 9/9] code added for checkboxes --- .../index-START.html | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/10 - Hold Shift and Check Checkboxes/index-START.html b/10 - Hold Shift and Check Checkboxes/index-START.html index aeac48e7f9..7e1f02670a 100644 --- a/10 - Hold Shift and Check Checkboxes/index-START.html +++ b/10 - Hold Shift and Check Checkboxes/index-START.html @@ -9,7 +9,7 @@ html { font-family: sans-serif; - background:#ffc600; + //background:#ffc600; } .inbox { @@ -99,6 +99,37 @@