From a159e708612bfe47705c2f98a17c122a188c19fe Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Wed, 21 Dec 2016 00:31:52 -0600 Subject: [PATCH 1/9] finished exercise 1 of 30 : ) --- 01 - JavaScript Drum Kit/index-START.html | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..201131d1e0 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,33 @@ From 33a7d63221777ecddedc39eb3bbfa2f84314ea91 Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Fri, 23 Dec 2016 15:53:47 -0600 Subject: [PATCH 2/9] finished course 2 --- 01 - JavaScript Drum Kit/index-START.html | 6 +++--- 02 - JS + CSS Clock/index-START.html | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 201131d1e0..5d7533cbff 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,8 +58,6 @@ From 324fb0946d6d7c036766127fab8b2bc89d290ef5 Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Fri, 23 Dec 2016 17:00:03 -0600 Subject: [PATCH 3/9] finished exercise 3 --- 03 - CSS Variables/index-START.html | 34 ++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..60db988f81 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -9,10 +9,10 @@

Update CSS Variables with JS

- + - + @@ -20,11 +20,25 @@

Update CSS Variables with JS

+ + From 87e03de9525a19646e231ec346f7ac24233948f1 Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Sat, 24 Dec 2016 17:02:33 -0600 Subject: [PATCH 4/9] finished exercise 4 --- 03 - CSS Variables/index-START.html | 4 ++ 04 - Array Cardio Day 1/index-START.html | 73 ++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 60db988f81..ba0e2510d2 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -66,6 +66,10 @@

Update CSS Variables with JS

function handleUpdate () { const suffix = this.dataset.size || ''; + // this.value is the value set on the input bar, from 0 25 with blur, for example. + // to create a scalable input bar, you can set the type of the input bar to 'range' + //suffix is the type of value, so it's 25 + px, for example. This tells the CSS how to + //change what it should. document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix); } diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 317883a4c1..11008d7671 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -32,28 +32,101 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + // with an implicit return. It returns true if this statement is true. + const inventorsFrom1500s = inventors.filter(inventor => + inventor.year <= 1600 && inventor.year >= 1500 + ) + // console.log('Let\s see if this works', inventorsFrom1500s); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + // reWritten with the implicit return. Each object is transformed into a part of what it once was. + const inventorFirstAndLast = inventors.map(inventor => + [inventor.first, inventor.last] + ) + + // console.log('testing 1, 2, 3', inventorFirstAndLast); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + // is a.year is greater than b.year, then this is true and you return 1, which means don't swap, I believe. Yep, when b < a you switch the two, otherwise they stay the same, so 1890 > 1898, switch. + // 1905 > 1898, false, returns -1, means that you DO want to switch the two values. + const inventorSorting = inventors.sort((a, b) => + // console.log('Returning this', a.year > b.year ? 1 : -1); + a.year > b.year ? 1 : -1 + ) + // console.log('birthdate oldest to youngest'); + // console.table( inventorSorting) + // Array.prototype.reduce() // 4. How many years did all the inventors live? + // the first parameter is the accumulator, so it needs to be the same type as the starting value, + // whatever that is. The reduce will continue to run through all the inventors and add 'em up. + const inventorSum = inventors.reduce((total, inventor) => + total + (inventor.passed - inventor.year) + , 0) + + // console.log('the total age of everyone lived is', inventorSum); // 5. Sort the inventors by years lived + // console.log('years lived youngest to oldest'); + const inventorsByYearsLived = inventors.sort((a, b) => + (a.passed - a.year) > (b.passed - b.year) + ) + // console.table( inventorsByYearsLived); // 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 category = document.querySelector('.mw-category'); + // const links = [...category.querySelectorAll('a')]; + // var de = links.map(link => + // link.textContent + // ).filter(streetName => + // streetName.includes('de') + // ) + + // const birthdays = [...document.querySelectorAll('.celebs-box')]; + + // const textContent = birthdays.map(celebBox => + // celebBox.textContent + // ) + // joinedCelebs = textContent.join('').split('\u21b5'); + + // 7. sort Exercise // Sort the people alphabetically by last name + const sortedPeople = people.sort((a, b) => { + a = a.split(','); + a = a[0] + b = b.split(','); + b = b[0] + + // console.log('a > b is', a > b ? 1 : -1); + // return a - b; + return a > b ? 1 : -1; + // console.log('commaLocation is', commaLocation); + }) + + // console.log('sortedPeople', sortedPeople); + // 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' ]; + // note how obj is starting blank. + const wayOfTransport = data.reduce((obj, transport) => { + if(!obj[transport]){ + obj[transport] = 0; + } + obj[transport] += 1; + return obj; + }, {}) + + console.log('wayOfTransport', wayOfTransport); + From 258d6c93afebca392139efc1216b379a3326dd21 Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Mon, 26 Dec 2016 12:12:20 -0600 Subject: [PATCH 5/9] finished day 5 --- 05 - Flex Panel Gallery/index-START.html | 60 +++++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..2d810531f8 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -16,16 +16,21 @@ } body { margin: 0; - } + } *, *:before, *:after { box-sizing: inherit; } +/* display: flex puts everything in one flex box, changes the panels from being vertically aligned to +horizontally aligned */ .panels { min-height:100vh; overflow: hidden; + display: flex; } +/* flex: 1 tells the panels to fill out all remaining space, basically take over the page */ +/*you can add display: flex to items that are already in flexboxes. you can put flexboxes in flexboxes*/ .panel { background:#6B0F9C; box-shadow:inset 0 0 0 5px rgba(255,255,255,0.1); @@ -34,13 +39,19 @@ align-items:center; /* Safari transitionend event.propertyName === flex */ /* Chrome + FF transitionend event.propertyName === flex-grow */ + /*need this transition or the whole thing breaks. It because of the flex statement in here*/ transition: font-size 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), - flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), + flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11); background 0.2s; font-size: 20px; background-size:cover; background-position:center; + flex: 1; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; } @@ -50,10 +61,29 @@ .panel4 { background-image:url(https://source.unsplash.com/ITjiVXcwVng/1500x1500); } .panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); } + /* these are everything inside of a flex panel. I.E. all of the

tags */ .panel > * { margin:0; width: 100%; transition:transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; + } + + /*Transform causes CSS fields to move. The translate -100% will move the first-child of every Panel off-screen going up, while the other will do the opposite to the last-child. When they are deactivated the items come back*/ + .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 { @@ -66,8 +96,10 @@ font-size: 4em; } + /*flex of 5 means that this panel will take 5 times the amount of extra room as the rest of the panels when it is open*/ .panel.open { font-size:40px; + flex: 5; } .cta { @@ -108,6 +140,30 @@ From ee602e60050891f75023196592620b262297da54 Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Tue, 27 Dec 2016 23:36:13 -0800 Subject: [PATCH 6/9] finished exercise 6 --- 06 - Type Ahead/index-START.html | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..33653e6c4a 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,70 @@ From 9d5378f6f8a306b4f42c762518188bb13892d3dc Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Mon, 2 Jan 2017 17:33:33 -0600 Subject: [PATCH 7/9] finished day 7 --- 07 - Array Cardio Day 2/index-START.html | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..2a5290417a 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,16 +26,64 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? + + // returns true for at least one person. + const overNineteen = (person => { + const currentDate = new Date().getFullYear(); + // if it's true for one person, then we are solid. + if(currentDate - person.year >= 19){ + return true; + } + + }) + + const anyAdults = people.some(overNineteen); + + // console.log(anyAdults); // Array.prototype.every() // is everyone 19 or older? + const allAdults = people.every(overNineteen); + + // 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 = (comment => { + if(comment.id === 823423){ + return comment; + } + }) + + // comments.find already means you're going to be using the comments array. Don't need to pass that in to findComment. All you need to do is add the logic to find the specific comment you're looking for, + // console.log(comments.find(findComment)); + // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + // the findIndex returns the index automatically, it doesn't matter what you add as the return to the function, oddly. + + const index = comments.findIndex(comment =>{ + if(comment.id === 823423){ + return true; + } + }) + + // comments.splice(index, 1); + + // console.log(comments); + + const newComments = [ + ...comments.slice(0, index), + // the first one slices everything from zero to the index (not inclusive of index) + // the second slice from one past the index all the way to the end of the comments array. + ...comments.slice(index + 1) + ] + + console.log(newComments) + From 8f9ac76e7ba30e216cb1b7cbee612acfa292957d Mon Sep 17 00:00:00 2001 From: Joey Steinberger Date: Mon, 2 Jan 2017 18:20:45 -0600 Subject: [PATCH 8/9] finished day8 --- 08 - Fun with HTML5 Canvas/index-START.html | 73 +++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..23569b1887 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -5,8 +5,81 @@ HTML5 Canvas +