From bf6eadc4cd2f11ea9af0f886680dd8aa34f2b4ca Mon Sep 17 00:00:00 2001 From: claudiopro Date: Fri, 9 Dec 2016 15:38:07 +0100 Subject: [PATCH 01/21] =?UTF-8?q?My=20solution=20to=201st=20challenge=20?= =?UTF-8?q?=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01 - JavaScript Drum Kit/index-MINE.html | 101 +++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 01 - JavaScript Drum Kit/index-MINE.html diff --git a/01 - JavaScript Drum Kit/index-MINE.html b/01 - JavaScript Drum Kit/index-MINE.html new file mode 100644 index 0000000000..a1226ab10c --- /dev/null +++ b/01 - JavaScript Drum Kit/index-MINE.html @@ -0,0 +1,101 @@ + + + + + JS Drum Kit + + + + + +
+
+ A + clap +
+
+ S + hihat +
+
+ D + kick +
+
+ F + openhat +
+
+ G + boom +
+
+ H + ride +
+
+ J + snare +
+
+ K + tom +
+ + +
+ L + tink +
+
+ + + + + + + + + + + + + + + + + + From 5e2db901e62f68ccacc8ed9e35291100b62c2835 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Fri, 9 Dec 2016 17:11:42 +0100 Subject: [PATCH 02/21] =?UTF-8?q?First=20stab=20at=20solving=202nd=20chall?= =?UTF-8?q?enge=20=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02 - JS + CSS Clock/index-MINE.html | 139 ++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 02 - JS + CSS Clock/index-MINE.html diff --git a/02 - JS + CSS Clock/index-MINE.html b/02 - JS + CSS Clock/index-MINE.html new file mode 100644 index 0000000000..c3dd198440 --- /dev/null +++ b/02 - JS + CSS Clock/index-MINE.html @@ -0,0 +1,139 @@ + + + + + Document + + + + +
+
+
+
+
+
+
+
+ + + + + + + From 047e94a71c8d4a03d39c0c025572a84ae281aef3 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Fri, 9 Dec 2016 17:18:25 +0100 Subject: [PATCH 03/21] =?UTF-8?q?Better=20solution=20for=202nd=20challenge?= =?UTF-8?q?=20=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02 - JS + CSS Clock/index-MINE.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/02 - JS + CSS Clock/index-MINE.html b/02 - JS + CSS Clock/index-MINE.html index c3dd198440..8e22deccc3 100644 --- a/02 - JS + CSS Clock/index-MINE.html +++ b/02 - JS + CSS Clock/index-MINE.html @@ -118,13 +118,17 @@ const now = new Date(); const secondsDegrees = toDegs(now.getSeconds(), 60); + // Hack: prevent flicker around 90deg if (secondsDegrees === 90) { - secondsHand.classList.add('hand-nospin'); + secondsHand.classList.add('hand-nospin'); + secondsCircle.classList.add('hand-nospin'); } secondsHand.style.transform = `rotate(${secondsDegrees}deg)`; secondsCircle.style.transform = `rotate(${secondsDegrees}deg)`; - if (secondsDegrees === 90) { + // Hack: restore wobbly animation past 90deg + if (secondsDegrees > 90) { secondsHand.classList.remove('hand-nospin'); + secondsCircle.classList.remove('hand-nospin'); } const minutesDegrees = toDegs(now.getMinutes(), 60); From d5b6c7fc16b2829dfe22152dea620ea5fdffc639 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Fri, 9 Dec 2016 17:29:30 +0100 Subject: [PATCH 04/21] Fixes title --- 02 - JS + CSS Clock/index-MINE.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02 - JS + CSS Clock/index-MINE.html b/02 - JS + CSS Clock/index-MINE.html index 8e22deccc3..1e435f0e91 100644 --- a/02 - JS + CSS Clock/index-MINE.html +++ b/02 - JS + CSS Clock/index-MINE.html @@ -2,7 +2,7 @@ - Document + JS + CSS Clock From 16ac3b0d30f63f188cc33471cf1d79a044ab09ef Mon Sep 17 00:00:00 2001 From: claudiopro Date: Fri, 9 Dec 2016 17:29:55 +0100 Subject: [PATCH 05/21] Fixes titles --- 02 - JS + CSS Clock/index-FINISHED.html | 2 +- 02 - JS + CSS Clock/index-START.html | 2 +- 02 - JS + CSS Clock/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/02 - JS + CSS Clock/index-FINISHED.html b/02 - JS + CSS Clock/index-FINISHED.html index 36c420f534..049f84c9c6 100644 --- a/02 - JS + CSS Clock/index-FINISHED.html +++ b/02 - JS + CSS Clock/index-FINISHED.html @@ -2,7 +2,7 @@ - Document + JS + CSS Clock diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 259280d228..24cb9685e0 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -2,7 +2,7 @@ - Document + JS + CSS Clock diff --git a/02 - JS + CSS Clock/index.html b/02 - JS + CSS Clock/index.html index 36c420f534..049f84c9c6 100644 --- a/02 - JS + CSS Clock/index.html +++ b/02 - JS + CSS Clock/index.html @@ -2,7 +2,7 @@ - Document + JS + CSS Clock From 092881b3d14dbab22cb7504718ab8b9b9d72db97 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sun, 11 Dec 2016 11:31:00 +0100 Subject: [PATCH 06/21] =?UTF-8?q?Proposed=20solution=20for=20challenge=20n?= =?UTF-8?q?o.=203=20=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03 - CSS Variables/index-MINE.html | 96 ++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 03 - CSS Variables/index-MINE.html diff --git a/03 - CSS Variables/index-MINE.html b/03 - CSS Variables/index-MINE.html new file mode 100644 index 0000000000..31590a711e --- /dev/null +++ b/03 - CSS Variables/index-MINE.html @@ -0,0 +1,96 @@ + + + + + Scoped CSS Variables and JS + + +

Update CSS Variables with JS

+ +
+ + + + + + + + +
+ + + + + + + + + From 1ac89e2a1f9db7a4b838304c6de0650fe11bd695 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sun, 11 Dec 2016 11:44:08 +0100 Subject: [PATCH 07/21] =?UTF-8?q?Improves=20solution=20=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03 - CSS Variables/index-MINE.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/03 - CSS Variables/index-MINE.html b/03 - CSS Variables/index-MINE.html index 31590a711e..10212cdbaa 100644 --- a/03 - CSS Variables/index-MINE.html +++ b/03 - CSS Variables/index-MINE.html @@ -73,10 +73,10 @@

Update CSS Variables with JS

function changeValue(e) { const prop = this.name, - newVal = `${this.value}${this.dataset.sizing ? this.dataset.sizing : ''}`; + newVal = `${this.value}${this.dataset.sizing || ''}`; - // The proposed solution modifies the body rule directly - // document.querySelector('body').style.setProperty(`--${this.name}`, newVal); + // The proposed solution modifies inline styles directly + // document.documentElement.style.setProperty(`--${this.name}`, newVal); // We modify the original :root rule directly, so it cascades nicely Array.from(document.styleSheets[0].cssRules).forEach(rule => { From f24f215428b1fd2e024b33fa6d36fdc943efbe07 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sun, 11 Dec 2016 12:37:26 +0100 Subject: [PATCH 08/21] Solutions to challenge no. 4 (incomplete) --- 04 - Array Cardio Day 1/index-MINE.html | 76 ++++++++++++++++++++++++ 04 - Array Cardio Day 1/index-START.html | 7 ++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 04 - Array Cardio Day 1/index-MINE.html diff --git a/04 - Array Cardio Day 1/index-MINE.html b/04 - Array Cardio Day 1/index-MINE.html new file mode 100644 index 0000000000..0e3e9803aa --- /dev/null +++ b/04 - Array Cardio Day 1/index-MINE.html @@ -0,0 +1,76 @@ + + + + + Array Cardio 💪 + + + + + diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 6e28e357d0..9d9e3bef57 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -18,7 +18,12 @@ { first: 'Marie', last: 'Curie', year: 1867, passed: 1934 }, { first: 'Johannes', last: 'Kepler', year: 1571, passed: 1630 }, { first: 'Nicolaus', last: 'Copernicus', year: 1473, passed: 1543 }, - { first: 'Max', last: 'Planck', year: 1858, passed: 1947 } + { first: 'Max', last: 'Planck', year: 1858, passed: 1947 }, + { first: 'Katherine', last: 'Blodgett', year: 1898, passed: 1979 }, + { first: 'Ada', last: 'Lovelace', year: 1815, passed: 1852 }, + { first: 'Sarah E.', last: 'Goode', year: 1855, passed: 1905 }, + { first: 'Lise', last: 'Meitner', year: 1878, passed: 1968 }, + { first: 'Hanna', last: 'Hammarström', year: 1829, passed: 1909 } ]; 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']; From 940b9a528f4cfca0fa0d2a6b298b6dda58e2d589 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sun, 11 Dec 2016 13:15:51 +0100 Subject: [PATCH 09/21] =?UTF-8?q?Completes=20solution=20of=20challenge=20n?= =?UTF-8?q?o.=204=20=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04 - Array Cardio Day 1/index-MINE.html | 32 +++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/04 - Array Cardio Day 1/index-MINE.html b/04 - Array Cardio Day 1/index-MINE.html index 0e3e9803aa..f6c3d4b99d 100644 --- a/04 - Array Cardio Day 1/index-MINE.html +++ b/04 - Array Cardio Day 1/index-MINE.html @@ -30,11 +30,11 @@ 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 boulevards = ['Boulevards of Paris', 'City walls of Paris', 'Thiers wall', 'Wall of Charles V', 'Wall of Philip II Augustus', 'City gates of Paris', 'Haussmann\'s renovation of Paris', 'Boulevards of the Marshals', 'Boulevard Auguste-Blanqui', 'Boulevard Barbès', 'Boulevard Beaumarchais', 'Boulevard de l\'Amiral-Bruix', 'Boulevard de Strasbourg', 'Boulevard des Capucines', 'Boulevard de la Chapelle', 'Boulevard de Clichy', 'Boulevard du Crime', 'Boulevard Haussmann', 'Boulevard de l\'Hôpital', 'Boulevard des Italiens', 'Boulevard de la Madeleine', 'Boulevard de Magenta', 'Boulevard Montmartre', 'Boulevard du Montparnasse', 'Boulevard Raspail', 'Boulevard Richard-Lenoir', 'Boulevard de Rochechouart', 'Boulevard Saint-Germain', 'Boulevard Saint-Michel', 'Boulevard de Sébastopol', 'Boulevard du Temple', 'Boulevard Voltaire', 'Boulevard de la Zone']; + // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's - const born_in_the_1500s = inventors.filter(inventor => { - return inventor.year < 1600 && inventor.year >= 1500; - }); + const born_in_the_1500s = inventors.filter(inventor => (inventor.year < 1600 && inventor.year >= 1500)); console.table(born_in_the_1500s); // Array.prototype.map() @@ -62,14 +62,38 @@ // 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 boulevards_with_de = boulevards.filter(boulevard => boulevard.indexOf('de') !== -1); + // Why includes instead of contains? See https://github.com/mootools/mootools-core/issues/2402 + const boulevards_with_de = boulevards.filter(boulevard => boulevard.includes('de')); + console.log(boulevards_with_de); // 7. sort Exercise // Sort the people alphabetically by last name + // const people_sorted_alphabetically_by_last_name = people.sort((person, other) => (person.split(', ')[1] > other.split(', ')[1] ? 1 : -1)); + const people_sorted_alphabetically_by_first_name = people.sort((person, other) => { + const [pLast, pFirst] = person.split(', '), + [oLast, oFirst] = other.split(', '); + return pFirst > oFirst ? 1 : -1; + }); + console.log(people_sorted_alphabetically_by_first_name); + // const people_sorted_alphabetically_by_last_name = people.sort((person, other) => (person.split(', ')[0] > other.split(', ')[0] ? 1 : -1)); + // const people_sorted_alphabetically_by_first_name = people.sort((person, other) => { + // const [pLast] = person.split(', '), + // [oLast] = other.split(', '); + // return pLast > oLast ? 1 : -1; + // }); + const people_sorted_alphabetically_by_last_name = people.sort((person, other) => (person > other ? 1 : -1)); + console.log(people_sorted_alphabetically_by_last_name); // 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 instances = data.reduce((count, instance) => { + count[instance] = count[instance] ? (count[instance] + 1) : 1; + // Must return the buffer + return count + }, {}); + console.log(instances); From d755d6b6ddf9421bdc74d146d9359979fe1f7db5 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sun, 11 Dec 2016 13:21:10 +0100 Subject: [PATCH 10/21] Hints at the JS Console --- 04 - Array Cardio Day 1/index-MINE.html | 1 + 1 file changed, 1 insertion(+) diff --git a/04 - Array Cardio Day 1/index-MINE.html b/04 - Array Cardio Day 1/index-MINE.html index f6c3d4b99d..dddc150f5e 100644 --- a/04 - Array Cardio Day 1/index-MINE.html +++ b/04 - Array Cardio Day 1/index-MINE.html @@ -5,6 +5,7 @@ Array Cardio 💪 + Psst: have a look at the JavaScript Console 💁 + + + + + From 78a75e176ad5a68bc53a4b4e3cc057abec2f2337 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Mon, 12 Dec 2016 18:32:36 +0100 Subject: [PATCH 12/21] =?UTF-8?q?My=20solution=20for=20challenge=20no.=206?= =?UTF-8?q?=20=F0=9F=8F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 06 - Type Ahead/index-MINE.html | 108 ++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 06 - Type Ahead/index-MINE.html diff --git a/06 - Type Ahead/index-MINE.html b/06 - Type Ahead/index-MINE.html new file mode 100644 index 0000000000..591658d601 --- /dev/null +++ b/06 - Type Ahead/index-MINE.html @@ -0,0 +1,108 @@ + + + + + Type Ahead 👀 + + + + +
+ +
    +
  • Filter for a city
  • +
  • or a state
  • +
+
+ + + From 49b5f53a41c32a894d3faa70b9aa58cb2485b21e Mon Sep 17 00:00:00 2001 From: claudiopro Date: Mon, 12 Dec 2016 19:12:05 +0100 Subject: [PATCH 13/21] =?UTF-8?q?Solution=20to=20challenge=20no.=207=20?= =?UTF-8?q?=F0=9F=9A=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04 - Array Cardio Day 1/index-MINE.html | 2 +- 07 - Array Cardio Day 2/index-MINE.html | 55 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 07 - Array Cardio Day 2/index-MINE.html diff --git a/04 - Array Cardio Day 1/index-MINE.html b/04 - Array Cardio Day 1/index-MINE.html index dddc150f5e..ba51bf5adf 100644 --- a/04 - Array Cardio Day 1/index-MINE.html +++ b/04 - Array Cardio Day 1/index-MINE.html @@ -5,7 +5,7 @@ Array Cardio 💪 - Psst: have a look at the JavaScript Console 💁 +

Psst: have a look at the JavaScript Console 💁

+ + From fa23d9ad2ce15bbd53623a2da04ffb063859ea8f Mon Sep 17 00:00:00 2001 From: claudiopro Date: Mon, 12 Dec 2016 19:24:24 +0100 Subject: [PATCH 14/21] Fixes typo --- 07 - Array Cardio Day 2/index-MINE.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/07 - Array Cardio Day 2/index-MINE.html b/07 - Array Cardio Day 2/index-MINE.html index e4b98cabe6..be137fc565 100644 --- a/07 - Array Cardio Day 2/index-MINE.html +++ b/07 - Array Cardio Day 2/index-MINE.html @@ -2,7 +2,7 @@ - Document + Array Cardio 💪💪

Psst: have a look at the JavaScript Console 💁

@@ -20,7 +20,7 @@ { text: 'Love this!', id: 523423 }, { text: 'Super good', id: 823423 }, { text: 'You are the best', id: 2039842 }, - { text: 'Ramen in my fav food ever', id: 123523 }, + { text: 'Ramen is my fav food ever', id: 123523 }, { text: 'Nice Nice Nice!', id: 542328 } ]; From 0c5fe745fad5ceea07fc462ccc34d7a1391d1335 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Mon, 12 Dec 2016 20:35:21 +0100 Subject: [PATCH 15/21] =?UTF-8?q?Adds=20solution=20to=20challenge=20no.=20?= =?UTF-8?q?8=20=F0=9F=8E=A8=F0=9F=96=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08 - Fun with HTML5 Canvas/index-MINE.html | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 08 - Fun with HTML5 Canvas/index-MINE.html diff --git a/08 - Fun with HTML5 Canvas/index-MINE.html b/08 - Fun with HTML5 Canvas/index-MINE.html new file mode 100644 index 0000000000..6ec51dd1a3 --- /dev/null +++ b/08 - Fun with HTML5 Canvas/index-MINE.html @@ -0,0 +1,79 @@ + + + + + HTML5 Canvas + + + + + + + + + From f356f3e530a659bc1cf7de00ebf9c2c4abdb0feb Mon Sep 17 00:00:00 2001 From: claudiopro Date: Mon, 12 Dec 2016 20:43:13 +0100 Subject: [PATCH 16/21] =?UTF-8?q?Fixes=20initialization=20of=20canvas=202d?= =?UTF-8?q?=20context=20=F0=9F=8E=A8=20=F0=9F=96=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08 - Fun with HTML5 Canvas/index-MINE.html | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/08 - Fun with HTML5 Canvas/index-MINE.html b/08 - Fun with HTML5 Canvas/index-MINE.html index 6ec51dd1a3..d3b5ef9a01 100644 --- a/08 - Fun with HTML5 Canvas/index-MINE.html +++ b/08 - Fun with HTML5 Canvas/index-MINE.html @@ -11,13 +11,6 @@ const canvas = document.querySelector('#draw'); const ctx = canvas.getContext('2d'); - setTimeout(() => { - ctx.strokeStyle = '#ff0000'; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.lineWidth = 1; - }, 0); - let isDrawing = false, lastX = 0, lastY = 0, @@ -54,6 +47,10 @@ function resizeCanvas(e) { [canvas.width, canvas.height] = [window.innerWidth, window.innerHeight]; + ctx.strokeStyle = '#ff0000'; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + ctx.lineWidth = 1; } canvas.addEventListener('mouseup', e => isDrawing = false); From 29ca3f07ae05a26045b9d1ee0333a646cdc94fd6 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Mon, 12 Dec 2016 21:57:30 +0100 Subject: [PATCH 17/21] =?UTF-8?q?Makes=20canvas=20touch=20friendly=20?= =?UTF-8?q?=F0=9F=91=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08 - Fun with HTML5 Canvas/index-MINE.html | 63 +++++++++++++++++----- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/08 - Fun with HTML5 Canvas/index-MINE.html b/08 - Fun with HTML5 Canvas/index-MINE.html index d3b5ef9a01..fd4d76eb99 100644 --- a/08 - Fun with HTML5 Canvas/index-MINE.html +++ b/08 - Fun with HTML5 Canvas/index-MINE.html @@ -17,11 +17,7 @@ hue = 0, direction = 1; - function draw(e) { - if (!isDrawing) { - return; - } - + function beginPath() { hue++; if (hue >= 360) { hue = 0; @@ -31,13 +27,39 @@ } ctx.lineWidth += direction; + ctx.strokeStyle = `hsl(${hue}, 100%, 50%)`; + ctx.beginPath(); + ctx.moveTo(lastX, lastY); + } + + function draw(e) { + e.preventDefault(); + if (!isDrawing) { + return; + } + + beginPath(); // Drain current x and y values from mouse event let {offsetX: x, offsetY: y} = e; + ctx.lineTo(x, y); + ctx.stroke(); - ctx.strokeStyle = `hsl(${hue}, 100%, 50%)`; - ctx.beginPath(); - ctx.moveTo(lastX, lastY); + // Update last x and y values + [lastX, lastY] = [x, y]; + } + + function drawTouch(e) { + e.preventDefault(); + const touch = e.changedTouches[0]; + if (!isDrawing) { + return; + } + + beginPath(); + + // Drain current x and y values from mouse event + let {pageX: x, pageY: y} = touch; ctx.lineTo(x, y); ctx.stroke(); @@ -53,14 +75,31 @@ ctx.lineWidth = 1; } - canvas.addEventListener('mouseup', e => isDrawing = false); - canvas.addEventListener('mouseout', e => isDrawing = false); - canvas.addEventListener('mousedown', e => { + function reset(e) { + isDrawing = false; + } + + function startAndStore(e) { [lastX, lastY] = [e.offsetX, e.offsetY]; isDrawing = true; - }); + } + + function startAndStoreTouch(e) { + const touch = e.changedTouches[0]; + [lastX, lastY] = [touch.pageX, touch.pageY]; + isDrawing = true; + } + + canvas.addEventListener('mouseup', reset); + canvas.addEventListener('mouseout', reset); + canvas.addEventListener('mousedown', startAndStore); canvas.addEventListener('mousemove', draw); + canvas.addEventListener('touchcancel', reset); + canvas.addEventListener('touchend', reset); + canvas.addEventListener('touchstart', startAndStoreTouch); + canvas.addEventListener('touchmove', drawTouch); + window.addEventListener('resize', resizeCanvas); resizeCanvas(); From d9d3e3b4a1f1482ef003cc6334ebe7a239371a10 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Thu, 15 Dec 2016 18:06:22 +0100 Subject: [PATCH 18/21] =?UTF-8?q?Adds=20the=20solution=20to=20challenge=20?= =?UTF-8?q?no.=209=20=F0=9F=8C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09 - Dev Tools Domination/index-MINE.html | 92 +++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 09 - Dev Tools Domination/index-MINE.html diff --git a/09 - Dev Tools Domination/index-MINE.html b/09 - Dev Tools Domination/index-MINE.html new file mode 100644 index 0000000000..64286779a5 --- /dev/null +++ b/09 - Dev Tools Domination/index-MINE.html @@ -0,0 +1,92 @@ + + + + + Console Tricks! + + + +

×BREAK×DOWN×

+ + + + From 650d0d492794b41ecc69fd61c97831dac431190c Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sat, 31 Dec 2016 13:38:43 +0100 Subject: [PATCH 19/21] Fixes indentation --- 09 - Dev Tools Domination/index-MINE.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/09 - Dev Tools Domination/index-MINE.html b/09 - Dev Tools Domination/index-MINE.html index 64286779a5..6860a1acff 100644 --- a/09 - Dev Tools Domination/index-MINE.html +++ b/09 - Dev Tools Domination/index-MINE.html @@ -63,7 +63,7 @@ console.log(`That means I am ${dog.age * 7} human years old 🐩`); if (dog.age > 7) { console.log(`Wow I am a really old dog 🙈`); - } + } console.groupEnd(dog.name); }); From 59d9375a88b2df4dbdebcb5a4bf9d3013272463e Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sat, 31 Dec 2016 14:17:52 +0100 Subject: [PATCH 20/21] =?UTF-8?q?My=20solution=20for=20Hold=20Shift=20to?= =?UTF-8?q?=20Check=20Multiple=20Checkboxes=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../index-MINE.html | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 10 - Hold Shift and Check Checkboxes/index-MINE.html diff --git a/10 - Hold Shift and Check Checkboxes/index-MINE.html b/10 - Hold Shift and Check Checkboxes/index-MINE.html new file mode 100644 index 0000000000..1cc0350edc --- /dev/null +++ b/10 - Hold Shift and Check Checkboxes/index-MINE.html @@ -0,0 +1,163 @@ + + + + + Hold Shift to Check Multiple Checkboxes + + + + +
+
+ +

This is an inbox layout.

+
+
+ +

Check one item

+
+
+ +

Hold down your Shift key

+
+
+ +

Check a lower item

+
+
+ +

Everything inbetween should also be set to checked

+
+
+ +

Try do it with out any libraries

+
+
+ +

Just regular JavaScript

+
+
+ +

Good Luck!

+
+
+ +

Don't forget to tweet your result!

+
+
+ + + + + From 34f2e6d1e14aa341399577bad1c9c4b3fffc96d1 Mon Sep 17 00:00:00 2001 From: claudiopro Date: Sat, 31 Dec 2016 14:19:15 +0100 Subject: [PATCH 21/21] Sets page title --- 10 - Hold Shift and Check Checkboxes/index-FINISHED.html | 2 +- 10 - Hold Shift and Check Checkboxes/index-START.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/10 - Hold Shift and Check Checkboxes/index-FINISHED.html b/10 - Hold Shift and Check Checkboxes/index-FINISHED.html index 3ce296cc4b..2b5d39a52c 100644 --- a/10 - Hold Shift and Check Checkboxes/index-FINISHED.html +++ b/10 - Hold Shift and Check Checkboxes/index-FINISHED.html @@ -2,7 +2,7 @@ - Document + Hold Shift to Check Multiple Checkboxes