From e98c2ac336ec23e7997a37e17b54a6c85a4cdd51 Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Tue, 13 Dec 2016 20:11:47 -0800 Subject: [PATCH 01/13] Day 2 CSS + JS Clock --- 02 - JS + CSS Clock/index-START.html | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..af81cbc0a9 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,11 +61,36 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.5s; + transition-timing-function: cubic-bezier(0.07, 1.76, 1, 1); } From dd1ea9a000d2e1625a744b77ad6cda12b1fae295 Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Tue, 13 Dec 2016 21:44:36 -0800 Subject: [PATCH 02/13] Load iFrame for JavaScript Drum Kit in a Jupyter Notebook --- .../Keyboard Drum Kit.ipynb | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 01 - JavaScript Drum Kit/Keyboard Drum Kit.ipynb diff --git a/01 - JavaScript Drum Kit/Keyboard Drum Kit.ipynb b/01 - JavaScript Drum Kit/Keyboard Drum Kit.ipynb new file mode 100644 index 0000000000..01cf3f90ba --- /dev/null +++ b/01 - JavaScript Drum Kit/Keyboard Drum Kit.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from IPython.display import IFrame\n", + "IFrame('index.html', width=700, height=350)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [Root]", + "language": "python", + "name": "Python [Root]" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} From 28808b9ad1ae79ceab5a4bd7196398b69d135f9c Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Wed, 14 Dec 2016 19:19:10 -0800 Subject: [PATCH 03/13] Day 3 Playing with CSS Variables and JS --- 03 - CSS Variables/index-START.html | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index ca2b59d077..c073c2a1c1 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,6 +21,21 @@

Update CSS Variables with JS

From 50919f3e1eb2202adbc0658b39647dea17d3192b Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Thu, 15 Dec 2016 19:17:34 -0800 Subject: [PATCH 04/13] Day 4 Array Cardio Day 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What’s this => operator all about? console.table is really useful Let’s understand map and reduce functions How can I get better code highlighting in chrome dev tools, word wrap in JS sources (no) Why use const instead of var? --- 04 - Array Cardio Day 1/index-START.html | 48 +++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index eec0ffc31d..7fe9a5e860 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -29,31 +29,77 @@ 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() + // Array.prototype.filter()d // 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 + 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? + const totalYears = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 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; + + }); + 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(link => link.textContent) +// .filter(streetName => streetName.includes('de')); // 7. sort Exercise // Sort the people alphabetically by last name + const alpha = people.sort((lastOne, nextOne) => { + const [aLast, aFirst] = lastOne.split(', '); + const [bLast, bFirst] = nextOne.split(', '); + return aLast > bLast ? 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; + } + obj[item]++; + return obj; + + }, {}) + console.log(transportation); From 7d6bc26ca6dff4bedf666059f7f7f77295b51af6 Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Fri, 16 Dec 2016 20:45:01 -0800 Subject: [PATCH 05/13] Day 5 Flex Panels Image Gallery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What’s this flex box thing? What is this css: `.panel > * {…` `.panel > *:first-child` --- 05 - Flex Panel Gallery/index-START.html | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..373d7d5e82 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,10 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + justify-content:center; + display: flex; + flex-direction: column; } @@ -54,8 +59,18 @@ 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 +82,7 @@ } .panel.open { + flex: 5; font-size:40px; } @@ -107,6 +123,21 @@ From 79368ce41048daeba2a0f020a2365d253dbbaa89 Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Sat, 17 Dec 2016 18:24:03 -0800 Subject: [PATCH 06/13] Day 06 Ajax Type Ahead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regular expressions! fetch is new is ES6, returns a promise, the blob has a son method spread items out an array with … Extra challenge, try and sort the cities by their distance to your geolocation --- 06 - Type Ahead/index-START.html | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..96f3c1c3d5 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,47 @@ From 4700e869c22a9fa0b05572922e1498e8b287c3fe Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Mon, 19 Dec 2016 15:30:45 -0800 Subject: [PATCH 07/13] Day 7 Array Cardio Day 2 --- 07 - Array Cardio Day 2/index-START.html | 30 +++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..ee1fcd8107 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -24,17 +24,45 @@ { text: 'Nice Nice Nice!', id: 542328 } ]; + console.log("ready?") + // Some and Every Checks - // Array.prototype.some() // is at least one person 19 or older? + // Array.prototype.some() // is at least one person 19? +// const isAdult = people.some(function(person){ +// const currentYear = (new Date()).getFullYear(); +// if(currentYear - person.year >= 19){ +// return true; +// } +// }); + + const isAdult = people.some(person => ((new Date()). + getFullYear()) - person.year >= 19); + + console.log({isAdult}); + // Array.prototype.every() // is everyone 19 or older? + const allAdults = people.every(person => ((new Date()). + getFullYear()) - person.year >= 19); + + 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 comment = comments.find(comment => 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); + const newComments = [ + ...comments.slice(0, index), + ...comments.slice(index + 1) + ]; From 2b5b3b8c187e24a2a6656b0752bbbe4ed760ebdd Mon Sep 17 00:00:00 2001 From: Benjamin Weisberg Date: Wed, 21 Dec 2016 15:58:34 -0800 Subject: [PATCH 08/13] Day 08 Fun with HTML Canvas What's this hsl color syntax? Multiple assignment in ES6 with [x, y] = [100, 90] --- 08 - Fun with HTML5 Canvas/index-START.html | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..8001e2b7a6 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,57 @@