diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..0673673f39 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,21 @@ diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..ee036a618e 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -62,11 +62,44 @@ position: absolute; top:50%; } + .second-hand { + height: 3px; + background-color: #fefefe; + box-shadow: 1px 1px 2px grey; + transform: rotate(90deg); + transform-origin: right; + } + .min-hand, + .hour-hand { + transform: rotate(90deg); + transform-origin: right; + transition: all 0.05s cubic-bezier(0, 2.87, 1, 1.41); + } diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..e4cee3de60 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -9,7 +9,7 @@

Update CSS Variables with JS

- + @@ -22,20 +22,29 @@

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..7bed1052b0 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -29,32 +29,91 @@ const flavours = ['Chocolate Chip', 'Kulfi', 'Caramel Praline', 'Chocolate', 'Burnt Caramel', 'Pistachio', 'Rose', 'Sweet Coconut', 'Lemon Cookie', 'Toffeeness', 'Toasted Almond', 'Black Raspberry Crunch', 'Chocolate Brownies', 'Pistachio Almond', 'Strawberry', 'Lavender Honey', 'Lychee', 'Peach', 'Black Walnut', 'Birthday Cake', 'Mexican Chocolate', 'Mocha Almond Fudge', 'Raspberry']; - 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']; + 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']; // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const result = inventors.filter(function(inventor) { + if (inventor.year >1500 && inventor.year<=1599) { + return true; + } + }); + + console.table(result); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + const inventorFirstAndLast = inventors.map(function(inventor, item) { + return `${inventor.first} ${inventor.last}`; + }); + + console.log(inventorFirstAndLast); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const sorted = inventors.sort(function (first, last) { + /* body... */ + if (first.year > last.year) { + return 1; + } + }); + + console.table(sorted); // Array.prototype.reduce() // 4. How many years did all the inventors live? - + const total = inventors.reduce(function(total, inventor) { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(total); // 5. Sort the inventors by years lived + const sortByAge = inventors.sort(function(a,b) { + const ageOfFirst = a.passed - a.year; + const ageOfLast = b.passed - b.year; + if (ageOfFirst > ageOfLast) { + return 1; + } + }); + console.table(sortByAge); // 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('.mw-category a')); + const streetNames = links.map(function(index, elem) { + const linkContent = index.innerText; + return linkContent; + }); + const filteredNames = streetNames.filter(function(streetName) { + return streetName.includes('de'); + }); + console.log(filteredNames);*/ // 7. sort Exercise // Sort the people alphabetically by last name + const alphaSorted = people.sort(function(firstOne, nextOne) { + + const [alast, afirst] = firstOne.split(', '); + const [blast, bfirst] = nextOne.split(', '); + return alast > blast ? 1 : -1; + }); + console.log(alphaSorted); // 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 data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck', 'varun','varun']; + + const summedUp = data.reduce(function(obj, item){ + if(!obj[item]){ + obj[item] = 0; + } + + obj[item]++; + return obj; + + },{}); + + console.log(summedUp); diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..41e7c33013 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,9 +24,15 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; } .panel { + flex: 1; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; background:#6B0F9C; box-shadow:inset 0 0 0 5px rgba(255,255,255,0.1); color:white; @@ -53,7 +59,11 @@ .panel > * { margin:0; width: 100%; - transition:transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; + transition: transform 0.5s; } .panel p { @@ -62,13 +72,24 @@ text-shadow:0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45); font-size: 2em; } + .panel p:first-child { + transform: translateY(-100%); + } + .panel p:last-child { + transform: translateY(100%); + } .panel p:nth-child(2) { font-size: 4em; } - - .panel.open { + .open { + flex: 5; font-size:40px; } + .open-active > p:last-child, + .open-active > p:first-child { + font-size: 1em; + transform: translateY(0); + } .cta { color:white; @@ -107,7 +128,21 @@
diff --git a/06 - Type Ahead/index-FINISHED.html b/06 - Type Ahead/index-FINISHED.html index 5902b43936..914de2f17b 100644 --- a/06 - Type Ahead/index-FINISHED.html +++ b/06 - Type Ahead/index-FINISHED.html @@ -9,10 +9,12 @@
- +
+ +
diff --git a/06 - Type Ahead/style.css b/06 - Type Ahead/style.css index 36dc55f30e..03d1d95b80 100644 --- a/06 - Type Ahead/style.css +++ b/06 - Type Ahead/style.css @@ -33,11 +33,16 @@ box-shadow: 0 0 5px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.19); } - + .autocomplete { + max-height: 384px; + overflow: hidden; + } .suggestions { margin: 0; padding: 0; position: relative; + max-height: 322px; + overflow: hidden; /*perspective:20px;*/ } .suggestions li { diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..2ff12a971a 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,37 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? + const isAdult = people.some((people) => { + return (new Date().getFullYear()) - people.year >= 19; + }); + console.log(isAdult); // Array.prototype.every() // is everyone 19? + const allAdult = people.every((people) => { + return (new Date().getFullYear()) - people.year >= 19; + }); + console.log(allAdult); // 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 didWeGetIt = comments.find(function(item) { + + if (item.id === 823423) { + return item.text; + } + }); - // Array.prototype.findIndex() + console.log(didWeGetIt); + + // 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); + + console.log(index); + 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..e78d55b1c2 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,66 @@