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
.contain { | |
background-color: #668edb; | |
} | |
.project-actions a { | |
background: rgba(255,255,255,0.3); | |
padding: 5px 10px; | |
color: #fff | |
} |
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
// Returns labels (column names) matching the result list of prepareSpreadsheetRow() below | |
function getBucketColumns () { | |
// select els of main bucket labels | |
var mainColumnEls = document.querySelectorAll('._GAOKb._GAznb ._GAlIb'); | |
// select els of detail bucket labels | |
var detailColumnEls = document.querySelectorAll('.C_ADVANCEDHISTOGRAMTABLE_SUBBUCKET_GROUP ._GAlIb'); | |
var columnNames = ["Start Date", "End Date", "Avg Load Time", "No of samples"]; | |
mainColumnEls.forEach(function (e) { | |
columnNames.push(e.innerText); | |
}); |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<div style="margin: 0 auto; max-width: 960px"> | |
<img src="https://via.placeholder.com/960" | |
srcset="https://via.placeholder.com/320 320w, | |
https://via.placeholder.com/640 640w, | |
https://via.placeholder.com/960 960w, | |
https://via.placeholder.com/1400 1400w" | |
sizes="(min-width: 960px) 960px, 100vw" |
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 is the service worker which intercepts all http requests | |
self.addEventListener('fetch', function fetcher (event) { | |
var request = event.request; | |
// check if request | |
if (request.url.indexOf('assets.contentful.com') > -1) { | |
// contentful asset detected | |
event.respondWith( | |
caches.match(event.request).then(function(response) { | |
// return from cache, otherwise fetch from network | |
return response || fetch(request); |
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
// all urls will be added to cache | |
function cacheAssets( assets ) { | |
return new Promise( function (resolve, reject) { | |
// open cache | |
caches.open('assets') | |
.then(cache => { | |
// the API does all the magic for us | |
cache.addAll(assets) | |
.then(() => { | |
console.log('all assets added to cache') |
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
// register service worker | |
navigator.serviceWorker.register('service-worker-cache-images.js', { scope: './' }) | |
.then(navigator.serviceWorker.ready) | |
.then(function () { | |
console.log('service worker registered') | |
}) | |
.catch(function (error) { | |
console.log('error when registering service worker', error, arguments) | |
}); |