From 94702156cd87ad5ea1cdf3882d991d7e8c40b390 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Mon, 19 Dec 2016 12:37:58 -0500 Subject: [PATCH 01/25] added keydown function and able to log out each key press --- 01 - JavaScript Drum Kit/index-START.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..2172511c9a 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -9,7 +9,7 @@
-
+
A clap
@@ -58,6 +58,19 @@ From 36bbb5c6fd79bfbca7037dc47d504395faaf5b60 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Mon, 19 Dec 2016 14:35:37 -0500 Subject: [PATCH 02/25] added playing css class when key is pressed and set setTimeout to be removed quickly --- 01 - JavaScript Drum Kit/index-START.html | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 2172511c9a..bae66aae34 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -9,7 +9,7 @@
-
+
A clap
@@ -59,17 +59,22 @@ From 5925408dcc9b552eda8c0ceccc8e4cf4a3b56fc3 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Mon, 19 Dec 2016 14:57:06 -0500 Subject: [PATCH 03/25] added sound function and added play sound if specific key is pressed --- 01 - JavaScript Drum Kit/index-START.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index bae66aae34..49ca623585 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,21 +58,42 @@ From 68ff292f1ceb74232795e1e7023cc6324fa8e6ac Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Tue, 20 Dec 2016 09:53:46 -0500 Subject: [PATCH 06/25] added JS knowledge to make clock hands rotate --- 02 - JS + CSS Clock/index-START.html | 31 +++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2a9d852ef4..9829779353 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -70,10 +70,35 @@ From 88cd26bc123795b45fd8280cd83c30d510b35f76 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Mon, 26 Dec 2016 13:56:58 -0500 Subject: [PATCH 07/25] added CSS variables and changed variables through JS --- 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..3feb3e7654 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,10 +21,24 @@

Update CSS Variables with JS

From cd0c6ce8fd5aa016c6407e95c0cd098f7ac4c298 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Wed, 4 Jan 2017 10:14:26 -0500 Subject: [PATCH 08/25] created filter method for inventors --- 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 4162bce339..816d2f442e 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,6 +33,16 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + // filter will loop over array and give us 'inventor' + + // const fifteen = inventors.filter(function(inventor) { + // if(inventor.year >= 1500 && inventor.year < 1600) { + // return true; // keep it! + // } + // }); + + 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 From 4f5826ee96b18324cacad61b17eb03730d96985f Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Wed, 4 Jan 2017 10:19:24 -0500 Subject: [PATCH 09/25] created inventors.map array of first and last name --- 04 - Array Cardio Day 1/index-START.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 816d2f442e..82522927db 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -46,6 +46,10 @@ // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + // will always return same amout of items as you give it + + const fullName = inventors.map(inventor => `${inventor.first} ${inventor.last}`); + console.log(fullName); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest From dbafd40c5b427604ffe7090d942067a702792212 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Wed, 4 Jan 2017 10:27:49 -0500 Subject: [PATCH 10/25] created inventors.sort and sorted youngest to oldest --- 04 - Array Cardio Day 1/index-START.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 82522927db..63c90d67ca 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -54,6 +54,18 @@ // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + // const ordered = inventors.sort(function(firstPerson, lastPerson) { + // if(firstPerson.year > lastPerson.year) { + // // this moves people up and down in array + // return 1; + // } else { + // return -1; + // } + // }); + + const ordered = inventors.sort((firstPerson, lastPerson) => firstPerson.year > lastPerson.year ? 1 : -1) + console.table(ordered); + // Array.prototype.reduce() // 4. How many years did all the inventors live? From e9cd9f75002181e254e4effd3fe28a113591ac01 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Wed, 4 Jan 2017 10:34:03 -0500 Subject: [PATCH 11/25] created inventors.reduce - how many years did all the inventors live --- 04 - Array Cardio Day 1/index-START.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 63c90d67ca..70dec20c03 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -68,6 +68,13 @@ // Array.prototype.reduce() // 4. How many years did all the inventors live? + // reduce is returning what was previously returned before + // setting 'total' to 0 + + const totalYears = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(totalYears); // 5. Sort the inventors by years lived From 694e8bc3c50bdc327183abd7a32502e7f343d9ba Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Wed, 4 Jan 2017 11:15:01 -0500 Subject: [PATCH 12/25] created reduce and sort exercises --- 04 - Array Cardio Day 1/index-START.html | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 70dec20c03..25b049ed41 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -78,17 +78,51 @@ // 5. Sort the inventors by years lived + const oldest = inventors.sort(function(a, b) { + const lastGuy = a.passed - a.year; + const nextGuy = b.passed - b.year; + return lastGuy > nextGuy ? -1 : 1; + // if(lastGuy > nextGuy) { + // return -1; + // } else { + // return 1 + // } + }); + 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 + // Array.from converts nodelist into an array + // const category = document.querySelector('.mw-category'); + // const links = Array.from(category.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 alpha = people.sort((lastOne, nextOne) => { + const [alast, afirst] = lastOne.split(', '); + const [blast, bfirst] = nextOne.split(', '); + return alast > blast ? 1 : -1; + }); + + console.log(alpha); // 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 50649160600a6bc56bec6bd95c266840ff0d1f37 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Mon, 9 Jan 2017 15:03:53 -0500 Subject: [PATCH 13/25] added flex panel transitions to panels --- 05 - Flex Panel Gallery/index-START.html | 42 +++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..9bdd0aec63 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,19 +42,44 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; /* Distributes each panel evenly across screen */ + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; } - .panel1 { background-image:url(https://source.unsplash.com/gYl-UtwNg_I/1500x1500); } .panel2 { background-image:url(https://source.unsplash.com/1CD3fd8kHnE/1500x1500); } .panel3 { background-image:url(https://images.unsplash.com/photo-1465188162913-8fb5709d6d57?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&w=1500&h=1500&fit=crop&s=967e8a713a4e395260793fc8c802901d); } .panel4 { background-image:url(https://source.unsplash.com/ITjiVXcwVng/1500x1500); } .panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); } + /*Flex Children*/ .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 { @@ -68,6 +94,7 @@ .panel.open { font-size:40px; + flex: 5; /* takes 5 times the extra room verses evenly distributing */ } .cta { @@ -107,7 +134,20 @@
From 727fa9d08e682b4855a11bc1d13ea367861dd2dc Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Mon, 9 Jan 2017 15:36:05 -0500 Subject: [PATCH 14/25] added fetch endpoint --- 06 - Type Ahead/index-START.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..f3e1c4e8fb 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -16,7 +16,24 @@ From 6af1a484c062070fc6bb4e65812fe655181f3dc4 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Wed, 11 Jan 2017 14:54:28 -0500 Subject: [PATCH 15/25] added displayMatches function --- 06 - Type Ahead/index-START.html | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index f3e1c4e8fb..c62aa634d7 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -21,19 +21,40 @@ // Fetch will return a promise - no need for callback fetch(endpoint) .then(blob => blob.json()) // it doesn't know it's a JSON file being called - .then(data => cities.push(...data)); // ES6's new way of pushing individual elements of an array into another array + .then(data => cities.push(...data)); // (spreading) ES6's new way of pushing individual elements of an array into another array function findMatches(wordToMatch, cities) { return cities.filter(place => { const regex = new RegExp(wordToMatch, 'gi') // gi = global and insensitive: searches for uppercase and lowercase - return place.city.match(regex) || place.state.match(regex); }) } +function numberWithCommas(x) { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); +} + function displayMatches() { - + const matchArray = findMatches(this.value, cities); + const html = matchArray.map(place => { + const regex = new RegExp(this.value, 'gi'); + const cityName = place.city.replace(regex, `${this.value}`); + const stateName = place.state.replace(regex, `${this.value}`); + return ` +
  • + ${cityName}, ${stateName} + ${numberWithCommas(place.population)} +
  • + `; + }).join(''); // turns array into string + suggestions.innerHTML = html; } + +const searchInput = document.querySelector('.search'); +const suggestions = document.querySelector('.suggestions'); + +searchInput.addEventListener('change', displayMatches) +searchInput.addEventListener('keyup', displayMatches) From c96002caacfc078a5eda7c3480aea21c9c111b17 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Fri, 3 Feb 2017 08:00:22 -0500 Subject: [PATCH 16/25] completed canvas exercise --- 07 - Array Cardio Day 2/index-START.html | 14 ++++++- 08 - Fun with HTML5 Canvas/index-START.html | 42 +++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..ba375feb04 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,25 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? + const isAdult = people.some(person => { + const currentYear = (new Date()).getFullYear(); + return currentYear - person.year >= 19; + }); + console.log({isAdult}); // Array.prototype.every() // is everyone 19? - + const allAdults = people.every(person => ((new Date()).getFullYear()) - person.year >= 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 findComment = comments.find(comment => comment.id === 823423); + console.log({findComment}); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const index = comments.findIndex(comment => comment.id === 823423); + comments.splice(index, 1); + console.table(comments); diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..ac95e17974 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,48 @@ From 5207e0fa4512a97ebd8986fdc88ebb818e6c1318 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Tue, 11 Apr 2017 13:15:55 -0400 Subject: [PATCH 23/25] sorted band array and displayed on DOM --- 17 - Sort Without Articles/index-START.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/17 - Sort Without Articles/index-START.html b/17 - Sort Without Articles/index-START.html index cfaf3e0440..d0d2ff8a19 100644 --- a/17 - Sort Without Articles/index-START.html +++ b/17 - Sort Without Articles/index-START.html @@ -45,6 +45,14 @@ From ced72fca6daa22735115e727297b37f57b61f99e Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Thu, 26 Oct 2017 19:17:29 -0700 Subject: [PATCH 24/25] Finished times using map and reduce --- .../index-START.html | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/18 - Adding Up Times with Reduce/index-START.html b/18 - Adding Up Times with Reduce/index-START.html index 3eaee0f3ef..19e627c721 100644 --- a/18 - Adding Up Times with Reduce/index-START.html +++ b/18 - Adding Up Times with Reduce/index-START.html @@ -182,6 +182,26 @@ From d9f2002051f074188b776f4dc50eaf2301fb4296 Mon Sep 17 00:00:00 2001 From: Chloe Collier Date: Fri, 3 Nov 2017 14:51:24 -0700 Subject: [PATCH 25/25] speech detection --- 20 - Speech Detection/index-START.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/20 - Speech Detection/index-START.html b/20 - Speech Detection/index-START.html index d3395cca35..9fdfbb60da 100644 --- a/20 - Speech Detection/index-START.html +++ b/20 - Speech Detection/index-START.html @@ -12,6 +12,30 @@