diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..2a1ec2fa7d 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,29 @@ diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index ee7eaefb1f..22c0879fac 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -9,8 +9,8 @@
-
-
+
+
@@ -62,12 +62,57 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform:rotate(90deg); + transition: all 0.5s; + transition-timing-function: cubic-bezier(0.04, 1.77, 0.32, 0.94); + } + hand.no-transition { + transition:none; } - diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 8a4f0d556e..6658df8f40 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -25,6 +25,21 @@

Update CSS Variables with JS

/* misc styles, nothing to do with CSS variables */ + :root{ + --spacing: 10px; + --blur: 10px; + --base: #ffc600; + } + + .hl { + color: var(--base); + } + + img { + padding: var(--spacing); + background: var(--base); + filter: blur(var(--blur)); + } body { text-align: center; @@ -45,6 +60,20 @@

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 eec0ffc31d..331770a7fd 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -29,30 +29,47 @@ const people = ['Beck, Glenn', 'Becker, Carl', 'Beckett, Samuel', 'Beddoes, Mick', 'Beecher, Henry', 'Beethoven, Ludwig', 'Begin, Menachem', 'Belloc, Hilaire', 'Bellow, Saul', 'Benchley, Robert', 'Benenson, Peter', 'Ben-Gurion, David', 'Benjamin, Walter', 'Benn, Tony', 'Bennington, Chester', 'Benson, Leana', 'Bent, Silas', 'Bentsen, Lloyd', 'Berger, Ric', 'Bergman, Ingmar', 'Berio, Luciano', 'Berle, Milton', 'Berlin, Irving', 'Berne, Eric', 'Bernhard, Sandra', 'Berra, Yogi', 'Berry, Halle', 'Berry, Wendell', 'Bethea, Erin', 'Bevan, Aneurin', 'Bevel, Ken', 'Biden, Joseph', 'Bierce, Ambrose', 'Biko, Steve', 'Billings, Josh', 'Biondo, Frank', 'Birrell, Augustine', 'Black, Elk', 'Blair, Robert', 'Blair, Tony', 'Blake, William']; + let answers = []; + // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's - + answers[1] = inventors.filter(p => p.year >= 1500 && p.year <= 1599) // Array.prototype.map() // 2. Give us an array of the inventors' first and last names - + answers[2] = inventors.map(p => `${p.first} ${p.last}`) // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + answers[3] = inventors.sort((a,b) => a.year > b.year ? 1 : -1) // Array.prototype.reduce() // 4. How many years did all the inventors live? + answers[4] = inventors.reduce((total, p) => total + p.passed - p.year, 0) // 5. Sort the inventors by years lived + answers[5] = inventors.sort((a,b) => a.passed - a.year > b.passed - b.year ? 1 : -1) + // add the years to the objects + // answers[5] = answers[5].map(p => {p.years = p.passed - p.year; return p}) // 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 = 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 - + answers[7] = people.sort((a,b) => a.split(', ')[0] > b.split(', ') [0] ? 1 : -1) // 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' ]; + answers[8] = data.reduce((result, dat) => { + //add one or initialize to one if undefined+1 == NaN + result[dat] = result[dat] + 1 || 1; + return result; + }, {}) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index c6509bed02..7752e6d502 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; + display:flex; + flex:1; + flex-direction: column; + align-items: center; + justify-content: center; } @@ -54,8 +60,21 @@ 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 > *:last-child{ + transform: translateY(100%); + } + .panel.open-active > *:first-child, .panel.open-active > *:last-child { + transform: translateY(0); + } .panel p { text-transform: uppercase; font-family: 'Amatic SC', cursive; @@ -68,6 +87,7 @@ .panel.open { font-size:40px; + flex:5; } @@ -102,7 +122,20 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..0c89fd442c 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -14,8 +14,39 @@
  • or a state
  • + diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..37bc0af732 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -27,14 +27,21 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? // Array.prototype.every() // is everyone 19 or older? + console.log("some over 19?", people.some(person => (new Date()).getFullYear() - person.year >= 19)) + console.log("all over 19?", people.every(person => (new Date()).getFullYear() - person.year >= 19)) // 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 + console.log("comment#823423", comments.find(obj => obj.id === 823423)) + // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + let index = comments.findIndex(obj => obj.id === 823423) + comments.splice(index, 1) + console.log("index of comment#823423",index, comments) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..e5d6b67f63 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -5,13 +5,61 @@ HTML5 Canvas - +

    CanvasPad

    + diff --git a/09 - Dev Tools Domination/index-START.html b/09 - Dev Tools Domination/index-START.html index 196fffd719..96772b5046 100644 --- a/09 - Dev Tools Domination/index-START.html +++ b/09 - Dev Tools Domination/index-START.html @@ -17,29 +17,72 @@ p.style.fontSize = '50px'; } - // Regular - - // Interpolated - - // Styled - - // warning! - - // Error :| - - // Info - - // Testing - - // clearing - - // Viewing DOM Elements - - // Grouping together - - // counting - - // timing + // Regular + console.log('hello'); + +// Interpolated +console.log('Hello I am a %s string!', '💩'); + +// Styled +console.log('%c I am some great text', 'font-size:50px; background:red; text-shadow: 10px 10px 0 blue') + +// warning! +console.warn('OH NOOO'); + +// Error :| +console.error('Shit!'); + +// Info +console.info('Crocodiles eat 3-4 people per year'); + +// Testing +const p = document.querySelector('p'); + +console.assert(p.classList.contains('ouch'), 'That is wrong!'); + +// clearing +console.clear(); + +// Viewing DOM Elements +console.log(p); +console.dir(p); + +console.clear(); + +// Grouping together +dogs.forEach(dog => { + console.groupCollapsed(`${dog.name}`); + console.log(`This is ${dog.name}`); + console.log(`${dog.name} is ${dog.age} years old`); + console.log(`${dog.name} is ${dog.age * 7} dog years old`); + console.groupEnd(`${dog.name}`); +}); + +// counting + +console.count('Wes'); +console.count('Wes'); +console.count('Steve'); +console.count('Steve'); +console.count('Wes'); +console.count('Steve'); +console.count('Wes'); +console.count('Steve'); +console.count('Steve'); +console.count('Steve'); +console.count('Steve'); +console.count('Steve'); + +// timing +console.time('fetching data'); +fetch('https://api.github.com/users/wesbos') + .then(data => data.json()) + .then(data => { + console.timeEnd('fetching data'); + console.log(data); + }); + +console.table(dogs); diff --git a/10 - Hold Shift and Check Checkboxes/index-START.html b/10 - Hold Shift and Check Checkboxes/index-START.html index a02071ff00..ef69c2b32a 100644 --- a/10 - Hold Shift and Check Checkboxes/index-START.html +++ b/10 - Hold Shift and Check Checkboxes/index-START.html @@ -99,6 +99,59 @@