From ca381175462621573684292072ecb120fb75805d Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Sun, 18 Dec 2016 15:20:20 -0500 Subject: [PATCH 01/14] one complete --- 01 - JavaScript Drum Kit/index-START.html | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..916cbbd9e6 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,30 @@ From 2b8b2819d880933262f52ff59f38b3600c556004 Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Mon, 19 Dec 2016 14:49:35 -0500 Subject: [PATCH 02/14] two complete --- 02 - JS + CSS Clock/index-START.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..828dca02fa 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,12 +61,40 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.05s; + /* transition-timing-function: cubic-bezier: adjusts appearance of motion*/ + transition-timing-function: cubic-bezier(.1, 2.7, .58, 1); } From 6fbb0518817a5a3e42917303a595c63b96198358 Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Thu, 22 Dec 2016 15:02:13 -0500 Subject: [PATCH 03/14] four complete --- 03 - CSS Variables/index-START.html | 29 +++++++++ 04 - Array Cardio Day 1/index-START.html | 77 ++++++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..e0e733a1fb 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,6 +21,21 @@

Update CSS Variables with JS

diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 4162bce339..247958ff63 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,29 +33,106 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + 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 + //will always return the same number of items as you give it + // const fullNames = inventors.map(inventor => + // inventor.first + ' ' + inventor.last); + // console.log(fullNames); + // //or + const fullNames = inventors.map(inventor => + `${inventor.first} ${inventor.last}`); + console.log(fullNames); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + //you get two items and you have to sort those two + + // const ordered = inventors.sort(function(a, b){ + // if (a.year > b.year){ + // return 1; + // } else { + // return -1; + // } + // }) + + // console.table(ordered) + //or + + const 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 totalYears = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + //to get the number of years they lived + }, 0) + console.log(totalYears); // 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 + //IN CONSOLE OF WIKI PAGE^ + //dev tools + // +// const category = document.querySelector('.mw-category'); +// const links = Array.from(category.querySelectorAll('a')); +// //convert list of links to list of names +// //array.from will make it into an array from the nodelist + +// const de = links +// .map(link => link.textContent) +// //will give the text inside of each link +// .filter(streetName => streetName.includes('de')); +// //will filter them out // 7. sort Exercise // Sort the people alphabetically by last name + const alpha = people.sort((lastOne, nextOne) => { + // console.log(lastOne); + const [last, first] = lastOne.split(', '); + const [lastN, firstN] = nextOne.split(', '); + // console.log(last, first); + // console.log(lastN, firstN); + return last > lastN ? 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(function(obj, item) { + if (!obj[item]){ + obj[item] = 0; + } + + // console.log(item); + obj[item] ++; + return obj; + }, {}) + console.log(transportation); + From 69fb20822d307beb70827e9c5d53b1e738d589d6 Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Thu, 22 Dec 2016 15:04:37 -0500 Subject: [PATCH 04/14] three complete --- 03 - CSS Variables/index-START.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index e0e733a1fb..dae79e9bb6 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -69,7 +69,7 @@

Update CSS Variables with JS

// console.log(this.value); console.log(this.dataset); const suffix = this.dataset.sizing || ''; - /*so you can take the px to the end of the new value below*/ + /*so you can take the px to the end of the new value below or else it won't read*/ document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix) } From a0994ff2f70deec706bdf00bba03cc3b3255ae46 Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Thu, 22 Dec 2016 15:55:06 -0500 Subject: [PATCH 05/14] five complete --- 05 - Flex Panel Gallery/index-START.html | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..70b00a94db 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,13 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + /*which means that they'll evenly distribute*/ + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; + /* nest the flex box*/ } @@ -54,8 +62,17 @@ 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 { text-transform: uppercase; font-family: 'Amatic SC', cursive; @@ -67,6 +84,8 @@ } .panel.open { + flex: 5; + /*flex of 5 means that when it has the class of open, it's going to be 5x the size of the rest of them*/ font-size:40px; } @@ -107,6 +126,21 @@ From 884582c676f76f427150499d5ab093c3d2222f70 Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Tue, 27 Dec 2016 14:36:29 -0500 Subject: [PATCH 06/14] six complete --- 06 - Type Ahead/index-START.html | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..a79d8e7fa2 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,62 @@ From 2b4b9abe1583077c61dc110c7d23d85681eb025a Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Tue, 27 Dec 2016 14:51:05 -0500 Subject: [PATCH 07/14] seven done --- 07 - Array Cardio Day 2/index-START.html | 57 +++++++++++++++++++++++- 1 file changed, 55 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..2739b7a077 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,9 +26,47 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? - // Array.prototype.every() // is everyone 19? + //will return true if there is at least one adult in people array who is over 19 + + // const isAdult = people.some(function(person){ + // const currentYear = (new Date()).getFullYear(); + // if(currentYear - person.year >= 19){ + // return true; + // } + // }); + // console.log(isAdult); + //or + + + 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 allAdult = people.every(person => { + const currentYear = (new Date()).getFullYear(); + return currentYear - person.year >= 19; + }); + console.log(allAdult); + + + + // // Array.prototype.find() + // const theComment = comments.find(function(comment) { + // if(comment.id === 823423){ + // return true; + // } + // }); + // console.log(theComment); + //or + + const theComment = comments.find(comment => + comment.id === 823423); + console.log(theComment); + - // 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 @@ -36,6 +74,21 @@ // Find the comment with this ID // delete the comment with the ID of 823423 + const index = comments.findIndex(comment => + comment.id === 823423); + console.log('index', index); + + // comments.splice(index, 1); + + //popular in redux world: + const newComments = [ + ...comments.slice(0, index), + ...comments.slice(index + 1) + ]; + + //will build new array of comments + //... will spread items into new array + From 0456723f6ffa622a4ea8d954f8b39631c438731d Mon Sep 17 00:00:00 2001 From: Hadas Werman Date: Tue, 27 Dec 2016 16:17:28 -0500 Subject: [PATCH 08/14] eight complete --- 08 - Fun with HTML5 Canvas/index-START.html | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..a202e24901 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,71 @@