npm i
cat > .env << EOL
CONTENTFUL_SPACE=
CONTENTFUL_DELIVERY_ACCESS_TOKEN=
CONTENTFUL_PREVIEW_ACCESS_TOKEN=
CONTENTFUL_INITIAL_SYNC=true
EOL
This file contains hidden or 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
// https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications | |
const isLocalhost = Boolean( | |
window.location.hostname === 'localhost' || | |
// [::1] is the IPv6 localhost address. | |
window.location.hostname === '[::1]' || | |
// 127.0.0.1/8 is considered localhost for IPv4. | |
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) | |
) |
This file contains hidden or 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
<script> | |
mounted () { | |
window.addEventListener('online', () => | |
store.dispatch('snackbar', { id: 0, show: false }) | |
) | |
window.addEventListener('offline', () => | |
store.dispatch('snackbar', { id: 0, show: true }) | |
) | |
This file contains hidden or 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 service worker file is effectively a 'no-op' that will reset any | |
// previous service worker registered for the same host:port combination. | |
// In the production build, this file is replaced with an actual service worker | |
// file that will precache your site's local assets. | |
// See https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432 | |
self.addEventListener('install', () => self.skipWaiting()) | |
self.addEventListener('activate', () => { | |
self.clients.matchAll({ type: 'window' }).then(windowClients => { |
This file contains hidden or 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
<!-- set pug as language, jade is only for gist sintax highlight --> | |
<template lang="jade"> | |
- var background = 'path(d="M0 0h24v24H0z" fill="none")' | |
svg(height="0" width="0" style="position:absolute; margin-left: -100%;") | |
//- If your shape consist of many small chunks, you’ll need to wrap them all with a g tag and add an ID to that group. | |
g#check-box-outline | |
#{background} | |
path(d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z") | |
g#check-box | |
#{background} |
This file contains hidden or 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
window.addEventListener('load', () => { | |
const t = performance.timing | |
// Log performance details: | |
for (const key of [ | |
'fetchStart', | |
'connectStart', | |
'connectEnd', | |
'requestStart', | |
'responseStart', | |
'responseEnd', |
This file contains hidden or 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
<template lang="pug"> | |
svg.icon.icon-settings( | |
fill="#000000" | |
height="24" | |
viewBox="0 0 24 24" | |
width="24" | |
xmlns="http://www.w3.org/2000/svg" | |
role="img" | |
aria-labelledby="iconSettingsTitle iconSettingsDescription" | |
) |
This file contains hidden or 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 CACHE_NAME = '$$$toolbox-cache$$$http://localhost:5000/$$$' | |
function linkIsAvailableOffline (links) { | |
links.forEach(link => { | |
const HREF = link.getAttribute('href') | |
caches.open(CACHE_NAME).then(cache => { | |
cache.match(HREF).then(response => { | |
link.setAttribute('data-offline', response ? true : false) | |
}) |
This file contains hidden or 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 setCookie = (name, value, days = 7, path = '/') => { | |
const expires = new Date(Date.now() + days * 864e5).toUTCString() | |
document.cookie = `${name}=${encodeURIComponent(value)}; expires=${expires}; path=${path}` | |
} | |
const getCookie = name => { | |
return document.cookie.split('; ').reduce((r, v) => { | |
const parts = v.split('=') | |
return parts[0] === name ? decodeURIComponent(parts[1]) : r | |
}, '') |
This file contains hidden or 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
dlbr@lnx:~/dev/dlbr-pwa$ npm outdated | |
Package Current Wanted Latest Location | |
contentful 4.5.0 4.5.2 4.5.0 dlbr-pwa | |
dlbr@lnx:~/dev/dlbr-pwa$ npx npm-check -u | |
npx: installed 218 in 5.926s | |
❤️ Your modules look amazing. Keep up the great work. ❤️ | |
dlbr@lnx:~/dev/dlbr-pwa$ npm update | |
+ [email protected] | |
added 120 packages and updated 4 packages in 4.263s |