From 9338736cd357ee96bf58fb3fbbd4a6463886c172 Mon Sep 17 00:00:00 2001 From: Oleg Tkachenko Date: Mon, 6 Feb 2017 01:40:25 +0200 Subject: [PATCH] commit start files --- .gitignore | 4 - 01 - JavaScript Drum Kit/index-START.html | 20 ++++- 02 - JS + CSS Clock/index-START.html | 35 +++++++-- 03 - CSS Variables/index-START.html | 31 +++++++- 04 - Array Cardio Day 1/index-START.html | 74 +++++++++++++++++-- 05 - Flex Panel Gallery/index-START.html | 44 +++++++++-- 06 - Type Ahead/index-START.html | 40 ++++++++++ 07 - Array Cardio Day 2/index-START.html | 22 +++++- 08 - Fun with HTML5 Canvas/index-START.html | 51 +++++++++++++ 09 - Dev Tools Domination/index-START.html | 31 ++++++++ .../index-START.html | 20 +++++ 11 - Custom Video Player/index.html | 1 + 11 - Custom Video Player/scripts.js | 67 +++++++++++++++++ 12 - Key Sequence Detection/index-START.html | 9 +++ 13 - Slide in on Scroll/index-START.html | 20 +++++ .../index-START.html | 74 +++++++++++++++++-- 15 - LocalStorage/index-START.html | 38 +++++++++- 15 - LocalStorage/style.css | 4 +- 16 - Mouse Move Shadow/index-start.html | 29 ++++++++ 17 - Sort Without Articles/index-START.html | 11 +++ .../index-START.html | 20 +++++ 19 - Webcam Fun/scripts.js | 4 + .../index-START.html | 22 +++++- 23 - Speech Synthesis/index-START.html | 33 +++++++++ readme.md | 17 ----- 25 files changed, 664 insertions(+), 57 deletions(-) delete mode 100644 .gitignore delete mode 100644 readme.md diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6e1a3738b8..0000000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -node_modules/ -*.log -haters/ diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..445dc7529d 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,25 @@ diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..36155bb645 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -56,17 +56,40 @@ } .hand { - width:50%; - height:6px; - background:black; - position: absolute; - top:50%; + width:50%; + height:6px; + background:black; + position: absolute; + top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all .05s; + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); } diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..a64755724c 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,7 +21,17 @@

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..279b13d1b4 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,29 +33,87 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's - + const fifteen = inventors.filter(function(inventor){ + if(inventor.year >= 1500 && inventor.year <= 1599) { + return true; + } + }); + + //arrow function + //const fifteen = inventors.filter(inventor => (inventor.year >= 1500 && inventor.year <= 1599)); + console.table(fifteen); + // Array.prototype.map() // 2. Give us an array of the inventors' first and last names - + const fullNames = inventors.map(function(inventor){ + return inventor.first + ' ' + inventor.last; + }) + + //const fullNames = inventors.map(inventor => `${inventor.first} ${inventor.last}`); + console.log(fullNames); + // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + /*const ordered = inventors.sort(function(a, b){ + if (a.year > b.year) { + return 1; + } else { + return -1; + } + });*/ + + 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? - + // 4. How many years did all the inventors live? + const totalYear = inventors.reduce(function( total, inventor) { + return total + (inventor.passed - inventor.year); + }, 0); + + console.log(totalYear); // 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; + }); + + 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 - + /*const category = document.querySelector('.mw-category'); + const links = Array.from(category.querySelectorAll('a')); + + const de = links + .map(function(link){ + return link.textContent; + }) + .filter(function(streetNames){ + return streetNames.toLowerCase().indexOf('de') !== -1; + }) + console.log(de);*/ // 7. sort Exercise // Sort the people alphabetically by last name - + const peopleSort = people.sort(function(last, first){ + const lastOne = last.split(', '); + const firstOne = first.split(', '); + return lastOne[1] > firstOne[1] ? 1 : -1; + }); + console.log(peopleSort); // 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']; + const transportation = data.reduce(function(obj, item){ + if (!obj[item]) { + obj[item] = 0; + } + obj[item]++; + return obj; + }, {}); + console.log(transportation); diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..b5448aa787 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 { @@ -31,7 +32,6 @@ box-shadow:inset 0 0 0 5px rgba(255,255,255,0.1); color:white; text-align: center; - align-items:center; /* Safari transitionend event.propertyName === flex */ /* Chrome + FF transitionend event.propertyName === flex-grow */ transition: @@ -41,6 +41,11 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; } @@ -54,8 +59,21 @@ margin:0; width: 100%; transition:transform 0.5s; + justify-content: center; + align-items: center; + display: flex; + flex: 1 0 auto; } - + .panel > *:first-child { + transform: translateY(-100%); + } + .panel.open-active > *:first-child, + .panel.open-active > *:last-child{ + transform: translateY(0); + } + .panel > *:last-child { + transform: translateY(100%); + } .panel p { text-transform: uppercase; font-family: 'Amatic SC', cursive; @@ -67,6 +85,7 @@ } .panel.open { + flex: 5; font-size:40px; } @@ -107,10 +126,23 @@ - - - diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..176b567516 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,46 @@ diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..c08052db6c 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,16 +26,34 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? - // Array.prototype.every() // is everyone 19? + const isAdult = people.some(function(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 => ((new Date()).getFullYear()) - person.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 comment = comments.find(function(comment){ + return comment.id === 823423; + }); + console.log(comment); + // 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..7dc9ba6143 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,57 @@ diff --git a/17 - Sort Without Articles/index-START.html b/17 - Sort Without Articles/index-START.html index cfaf3e0440..9e3473b52c 100644 --- a/17 - Sort Without Articles/index-START.html +++ b/17 - Sort Without Articles/index-START.html @@ -45,6 +45,17 @@ diff --git a/18 - Adding Up Times with Reduce/index-START.html b/18 - Adding Up Times with Reduce/index-START.html index 3eaee0f3ef..c6c04b937e 100644 --- a/18 - Adding Up Times with Reduce/index-START.html +++ b/18 - Adding Up Times with Reduce/index-START.html @@ -5,6 +5,7 @@ Videos +