From 9237605915f5527de91c10b8126e2fb1581cc5c9 Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Sat, 17 Dec 2016 17:25:30 +0100 Subject: [PATCH 1/7] Fin de l'exercices My honesty force me to say that i don't found alone the hour formula. --- 02 - JS + CSS Clock/index-START.html | 37 +++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..9456067233 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -18,7 +18,7 @@ From 593d178c89f5cebb83aa4a85e3ff5365d43f92d9 Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Sat, 17 Dec 2016 17:28:06 +0100 Subject: [PATCH 2/7] =?UTF-8?q?Suppression=20des=20ligne=20sur=20num=C3=A9?= =?UTF-8?q?raire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02 - JS + CSS Clock/index-START.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 9456067233..f1a0d95425 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -95,14 +95,10 @@ const hour = now.getHours(); const hourDegrees = ((hour / 12) * 360) + 90; hourHand.style.transform = `rotate(${hourDegrees}deg)`; - } - + //mise a jour de l'heure setInterval(setDate, 1000); - - - From 5c1318afdb4812be79bcf854d8ee0c4eeb66a142 Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Sat, 17 Dec 2016 19:19:45 +0100 Subject: [PATCH 3/7] fini. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3 eme jour, Je n'ai pas beaucoup chercher pour réussir l'exercice car il y avait trop de notions inconnues. Mais j'ai appris plein de trucs du coup j'ai fait quelque recherche pour vraiment comprendre et je l'ai rajouté en commentaire --- 03 - CSS Variables/index-START.html | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..2fb7964fc2 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -22,6 +22,35 @@

Update CSS Variables with JS

From f39a73f64cfbf45edfd4244ac39ecb73c626d046 Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Sun, 18 Dec 2016 18:57:32 +0100 Subject: [PATCH 4/7] fini mais a revoir --- 04 - Array Cardio Day 1/index-START.html | 80 ++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 4162bce339..a9dfb7ae1e 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,28 +33,108 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + //My solution + function bornedIn1500(inventors) { + if (inventors.year >= 1500 && inventors.year < 1600) return true; + } + console.log(inventors.filter(bornedIn1500)); + + //Wes's Solution + 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 + //My solution + const fullNames = inventors.map(inventor => inventor.first + " " + inventor.last); + console.log(fullNames); + + //Wes's Solution + const fullNames2 = inventors.map(inventor => `${inventor.first} ${inventor.last}`); + console.log(fullNames2); + // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + //my Solution + const orderedByYears = inventors.sort(function (a, b){ + return (a.year > b.year)? 1 : -1 ; + }); + console.table(orderedByYears); + + //Wes's Solution + 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? + //ça sert a rien mais j'ai fait ça + const lifeTime = inventors.map(inventor =>`${inventor.first} ${inventor.last} ${ inventor.passed - inventor.year}` ); + console.log(lifeTime); + //my solution + const lifeTimesTotal = inventors.reduce((total, inventor) => total + (inventor.passed - inventor.year), 0); + console.log(lifeTimesTotal); + + //Wes's Solution + const totalYears = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + },0); + console.log(totalYears); + // 5. Sort the inventors by years lived + //My Solution + const oldest = inventors.sort((a, b)=> a.passed - a.year > b.passed - b.year ? -1 : 1 ); + console.table(oldest); + + //Wes's Solution + const oldest2 = inventors.sort(function (a, b){ + const lastGuy = a.passed - a.year; + const nextGuy = b.passed - b.year; + return lastGuy > nextGuy ? -1 : 1; + }); + console.table(oldest2); + // 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');//on peux aussi faire document.querySelector('mw-category a'); + //on peux appler queryselectorAll sur tout les query + const links = [...category.querySelectorAll('a')]; //avec [... query] on transforme la nodeList en tableau + + const de = links + .map(link => link.textContent) + .filter(streerName => streerName.includes('de')); + console.log(de);*/ // 7. sort Exercise // Sort the people alphabetically by last name + //my bad solution + const Alphabetical = people.sort(guy => guy[0]); + console.log(Alphabetical); + + //wes's Solution + 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((obj, item)=>{ + if(!obj[item]){ + obj[item] = 0; + } + obj[item]++; + return obj; + },{}); + console.log(transportation); From 267d407bf435b5ddf1c1e181486e14419c47f473 Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Mon, 19 Dec 2016 16:36:16 +0100 Subject: [PATCH 5/7] mes fichiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit très bonne revision de tout ce qu'on peu faire avec les flex box --- 05 - Flex Panel Gallery/index-START.html | 79 +--------------------- 05 - Flex Panel Gallery/script.js | 22 +++++++ 05 - Flex Panel Gallery/style.css | 84 ++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 76 deletions(-) create mode 100644 05 - Flex Panel Gallery/script.js create mode 100644 05 - Flex Panel Gallery/style.css diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..b789a1322b 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -4,78 +4,10 @@ Flex Panels 💪 + -
@@ -84,7 +16,7 @@

Let's

Dance

-
+

Give

Take

Receive

@@ -106,11 +38,6 @@
- - - - + diff --git a/05 - Flex Panel Gallery/script.js b/05 - Flex Panel Gallery/script.js new file mode 100644 index 0000000000..445622c1c3 --- /dev/null +++ b/05 - Flex Panel Gallery/script.js @@ -0,0 +1,22 @@ +/** + * Created by nausicaaj on 19/12/2016. + */ + + //je selectionne tout mes panneaux +const panels = document.querySelectorAll('.panel'); + +//fajoute et supprime la classe 'open' qui permet d'ouvrir et de fermer mes panneaux quand on clique dessus +function openWide() { + this.classList.toggle('open'); +} + + +//ajoute et supprime la clacce 'open-active' pour recentrer les mot du haut et du bas +function callWords(e) { + console.log(e.propertyName); + if (e.propertyName.includes('flex')) this.classList.toggle('open-active'); + +} +//on aurait pu mettre (e.propertyName === 'flex-box' mais ça aurait été pas très bien compris par safary +panels.forEach(panel => panel.addEventListener('click', openWide)); +panels.forEach(panel => panel.addEventListener('transitionend', callWords)); diff --git a/05 - Flex Panel Gallery/style.css b/05 - Flex Panel Gallery/style.css new file mode 100644 index 0000000000..2b77439970 --- /dev/null +++ b/05 - Flex Panel Gallery/style.css @@ -0,0 +1,84 @@ +html { + box-sizing: border-box; + background:#ffc600; + font-family:'helvetica neue'; + font-size: 20px; + font-weight: 200; +} +body { + margin: 0; +} +*, *:before, *:after { + box-sizing: inherit; +} + +.panels { + min-height:100vh; + overflow: hidden; + display: flex; +} + +.panel { + background:#6B0F9C; + 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: + font-size 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), + flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), + background 0.2s; + font-size: 20px; + background-size:cover; + background-position:center; + justify-content: center; + align-items: center; + display: flex; + flex: 1; + flex-direction: column; +} + + +.panel1 { background-image:url(https://source.unsplash.com/gYl-UtwNg_I/1500x1500); } +.panel2 { background-image:url(https://source.unsplash.com/1CD3fd8kHnE/1500x1500); } +.panel3 { background-image:url(https://images.unsplash.com/photo-1465188162913-8fb5709d6d57?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&w=1500&h=1500&fit=crop&s=967e8a713a4e395260793fc8c802901d); } +.panel4 { background-image:url(https://source.unsplash.com/ITjiVXcwVng/1500x1500); } +.panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); } + +.panel > * { + 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; + 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:nth-child(2) { + font-size: 4em; +} + +.panel.open { + + flex: 5; + font-size: 40px; +} + +.cta { + color:white; + text-decoration: none; +} \ No newline at end of file From 1d5a52892018555fa3e9b2df50808ed5222536ec Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Tue, 20 Dec 2016 16:07:28 +0100 Subject: [PATCH 6/7] finish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit la récuperation des objets du dom devient de plus en plus simple les evenements aussi. je vais essayé dans faire un autre.. je sais pas si je pourrait faire un si beau css mais le fonctionnement de la recherche c'est ok :) --- 06 - Type Ahead/index-START.html | 68 ++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..b24a3e2b75 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -1,22 +1,58 @@ - - - Type Ahead 👀 - - - + + + Type Ahead 👀 + + + -
- -
    -
  • Filter for a city
  • -
  • or a state
  • -
-
- + const cities = []; + const objet = fetch(endpoint) + .then(blob => blob.json()) + .then(data => cities.push(...data)); + console.log(objet); + + function findMatches(wordToMatch, cities) { + return cities.filter(place =>{ + //voyons si on a une ville ou un etat qui correspond a la recherche + const regex = new RegExp(wordToMatch, "gi"); + return place.city.match(regex) || place.state.match(regex); + }); + } + function displayMatches(e) { + const matchArray = findMatches(e.target.value, cities); + const html = matchArray.map(place => { + const regex = new RegExp(e.target.value, 'gi'); + const cityName = place.city.replace(regex,`${e.target.value}`); + const stateName = place.state.replace(regex,`${e.target.value}`); + return ` +
  • + ${cityName}, ${stateName} + ${numberWithCommas(place.population)} +
  • `; + }).join(''); + suggestionInput.innerHTML = html; + } + //regex toute faite qui rajoute des virgules auw grand nombre + function numberWithCommas(x) { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + } + const searchInput = document.querySelector('.search'); + const suggestionInput = document.querySelector('.suggestions'); + + searchInput.addEventListener('change', displayMatches); + searchInput.addEventListener('keyup', displayMatches); + From b7e292c3fa4ec9d3b6890e204b6f7ee779f71258 Mon Sep 17 00:00:00 2001 From: Nausicaa Jarrige Date: Wed, 21 Dec 2016 13:37:16 +0100 Subject: [PATCH 7/7] fini petit kata sans forcer --- 07 - Array Cardio Day 2/index-START.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..18da822aa9 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,16 +26,35 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? + + const isAdult = people.some((person) => ((new Date()) + .getFullYear()) - person.year >= 19); + // Array.prototype.every() // is everyone 19? + const allAdult = people.every(person => ((new Date()) + .getFullYear()) - person.year >= 19); + console.log({isAdult}); + 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(comment => comment.id === 823423); + console.log(comment); // Array.prototype.findIndex() + const index = comments.findIndex(comment => comment.id === 823423); + console.log(index); // Find the comment with this ID // delete the comment with the ID of 823423 + //comments.splice(index,1); + const newComments = [ + ...comments.slice(0, index), + ...comments.slice(index + 1) + ]; + console.table(comments); + console.table(newComments);