This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('activate', function(event) { | |
event.waitUntil( | |
caches.keys().then(function (cacheNames) { | |
return Promise.all( | |
cacheNames.filter(function (cacheNames) { | |
return cacheNames.startsWith('wittr-') && | |
cacheNames !== staticCacheName; | |
}).map(function (cacheNames) { | |
return caches.delete(cacheNames); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('fetch', function(event) { | |
// TODO: respond to all requests with an html response | |
// containing an element with class="a-winner-is-me". | |
// Ensure the Content-Type of the response is "text/html" | |
console.log(event.request); | |
event.respondWith( | |
new Response('<strong class="a-winner-is-me">Hello Alberto</strong>', { | |
headers: { | |
'foo': 'bar', | |
'content-type': 'text/html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{/* This code is for the Icon of validation (Good & Bad) */} | |
{ | |
showValidationStyles && | |
<Icon | |
className={classNames('validationIcon')} | |
name={validationIconName} | |
size='18px' | |
/> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function delete the especial characters in the strings (es6) | |
handleAccents = (str) => { | |
const accents = 'ÀÁÂÃÄÅàáâãäåßÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž' | |
const accentsOut = 'AAAAAAaaaaaaBOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz' | |
str = str.split('') | |
str.forEach((letter, index) => { | |
const i = accents.indexOf(letter) | |
if (i !== -1) { str[index] = accentsOut[i] } | |
}) | |
return str.join('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getLocale = () => { | |
let browserLanguage = 'en' | |
if (window.navigator && (window.navigator.language || window.navigator.userLanguage)) { | |
browserLanguage = (window.navigator.language || window.navigator.userLanguage).substr(0, 2); | |
} | |
return browserLanguage | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch(`https://api.unsplash.com/search/photos?page=1&query=${searchedForText}`, { | |
headers: { | |
Authorization: 'Client-ID abc123' | |
} | |
}).then(response => response.json()) | |
.then(addImage); | |
function addImage(data) { | |
debugger; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cname = 'jwt' | |
let name = cname + '=' | |
let decodedCookie = decodeURIComponent(document.cookie) | |
let ca = decodedCookie.split(';') | |
for (var i = 0; i < ca.length; i++) { | |
var c = ca[i] | |
if (c.indexOf(name) === 0) { | |
console.log('works') | |
let token = c.substring(name.length, c.length) | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{/* TODO remove in 100 days */} | |
<span | |
className={styles.bodyBg} | |
style={{opacity: `${ | |
1.0 - ((new Date().getTime() - new Date('2017-06-09').getTime()) / 8640000000) | |
}`}} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
6 | |
]; | |
const sum = (arr) => arr.reduce((a, b) => a + b, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
email = [email protected] | |
name = Alberto Perez | |
[alias] | |
h = "! cat ~/.gitconfig" | |
# List of shortcuts | |
co = checkout |