Skip to content

Instantly share code, notes, and snippets.

View anton-karlovskiy's full-sized avatar
🎯
Focusing

Anton Karlovskiy anton-karlovskiy

🎯
Focusing
View GitHub Profile
@anton-karlovskiy
anton-karlovskiy / links.md
Created November 3, 2020 14:26 — forked from addyosmani/links.md
this.performance links
@anton-karlovskiy
anton-karlovskiy / functional-utils.js
Created November 3, 2020 14:23 — forked from bendc/functional-utils.js
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@anton-karlovskiy
anton-karlovskiy / blob-to-base64.js
Last active June 30, 2020 21:03 — forked from n1ru4l/index.js
Fetch blob and convert to base64
const fetchAsBlob = url => fetch(url).then(response => response.blob());
const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
});
@anton-karlovskiy
anton-karlovskiy / workbox.md
Created May 28, 2020 09:53 — forked from addyosmani/workbox.md
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()