Skip to content

Instantly share code, notes, and snippets.

View oliverturner's full-sized avatar
😀
Doing the thing

Oliver Turner oliverturner

😀
Doing the thing
View GitHub Profile
@oliverturner
oliverturner / index.html
Created February 2, 2024 12:56 — forked from davidwhitney/index.html
The Worlds Smallest UI Binding Library
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
<script type="module">
function someClick() {
alert("hello");
@oliverturner
oliverturner / totalCacheSize.js
Created October 11, 2019 19:46 — forked from jeffposnick/totalCacheSize.js
Snippet to get the total size of everything in the Cache Storage API for the current origin
async function totalCacheSize() {
let size = 0;
const cacheNames = await caches.keys();
for (const cacheName of cacheNames) {
const cache = await caches.open(cacheName);
const cachedRequests = await cache.keys();
for (const cachedRequest of cachedRequests) {
const cachedResponse = await cache.match(cachedRequest);
const responseBlob = await cachedResponse.blob();
size += responseBlob.size;
@oliverturner
oliverturner / coverage.js
Created February 28, 2018 11:37 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*
* Shows how to use Puppeeteer's code coverage API to measure CSS/JS coverage across
* different points of time during loading. Great for determining if a lazy loading strategy
* is paying off or working correctly.
*
* Install:
* npm i puppeteer chalk cli-table
const stream = require('stream')
const cache = new Map() // you might wanna use an lru here
function createCacheStream (url) {
const buf = []
return stream.Transform({
transform: function (data, enc, cb) {
buffer.push(data)
cb(null, data)
},
@oliverturner
oliverturner / css-with-react-checklist.md
Last active April 17, 2017 10:47 — forked from DavidWells/css-with-react-checklist.md
Lots of talk about different CSS solutions for React. This gist attempts to shed light on pros/cons of approaches.

Here is a checklist of all the things I need my CSS solution to handle.

I can explain any of the points. Leave a comment on the gist or tweet @DavidWells

Challenge: Take your favorite CSS solution and see how the checklist holds up.

  • Has ability Localize classes
  • Has ability to use global classes
  • Has ability to write raw CSS
  • Syntax highlighting and auto completion (beyond a specific editor)