Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.
You've got two main options:
addEventListener("fetch", e => { | |
if (e.request.destination !== "image" || // Only do this when requesting an image | |
request.mode === "no-cors") // We don't know the status of no-cors images | |
return; | |
e.respondWith((async () => { | |
try { | |
const response = await fetch(e.request); | |
if (response.ok) | |
return response; |
{-# LANGUAGE TypeSynonymInstances #-} | |
data Dual d = D Float d deriving Show | |
type Float' = Float | |
diff :: (Dual Float' -> Dual Float') -> Float -> Float' | |
diff f x = y' | |
where D y y' = f (D x 1) | |
class VectorSpace v where | |
zero :: v |
// This script checks if a page is bfcache eligible and prints reasons if it isn't. | |
// It can be easily modified to check multiple pages. | |
// Chrome crbug: https://bugs.chromium.org/p/chromium/issues/detail?id=1312486 | |
// Puppeteer issue: https://github.com/puppeteer/puppeteer/issues/8182 | |
const puppeteer = require('puppeteer'); | |
(async () => { | |
// Configuring and launching the browser |
const rels = ['preload', 'prefetch', 'preconnect', 'dns-prefetch', 'prerender', 'modulepreload'] | |
rels.forEach(element => { | |
const linkElements = document.querySelectorAll(`link[rel="${element}"]`) | |
const dot = linkElements.length > 0 ? '🟩' : '🟥' | |
console.log(`${dot} ${element}`) | |
linkElements.forEach(el => console.log(el)) | |
}); |
self.addEventListener('fetch', evt => { | |
// Fallback for subresource requests or in browsers that do not | |
// support navigation preload. | |
if (evt.request.mode !== "navigate" || !evt.preloadResponse) | |
return; | |
evt.respondWith(async _ => { | |
// Try to get the navigation preload response. | |
let r = await evt.preloadResponse; | |
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e | |
// by @levelsio | |
// HOW TO | |
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1 | |
// 2) Publish your Google Sheet, File -> Publish To Web | |
// 3) Copy the SHEET_ID in the URL, put it in here below: | |
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" | |
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188 | |
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc) |
This document proposes a new resource batch file format, together with a concept of preloading resource batches on the Web. This proposal is derived from Web Bundles by Jeffrey Yasskin and dynamic bundle serving by Yoav Weiss, with significant input from Pete Snyder, who raised concerns about Web Bundles.
When loading subresources on the Web, developers currently have an unfortunate choice between serving resources individually, or using bundlers, both of which have disadvantages which hurt loading performance. This document proposes a new mechanism, "resource batch preloading", which allows subresources to be loaded
Note: Since writing this, I've been pointed to some exciting new research/tooling called Project Cambria https://www.inkandswitch.com/cambria.html I'll likely have to rewrite this article taking that into account. Leaving this up for posterity's sake.
(This series isn't meant to be a primer/tutorial, though we might do something regarding it in the future. For official documentation and starters, see https://developers.cloudflare.com/workers/learning/using-durable-objects.
Further - these are my personal views; I expect to be wrong about a lot of them. Indeed, I'm not paying much attention to presenting these well at the moment, simply writing down thoughts. As such, expect these writeups to change often, particularly as the platform takes shape. I'm also mostly a front end guy, so don't get mad if I get it very wrong. Give me feedback! Always happy to learn and make changes.)
Durable Objects are a fascinating new storage primitive from cloudflare for their workers platform. There's a lot of 'cool'
#!/usr/bin/env bash | |
set -eou pipefail | |
profile=$1 | |
frameRate=${2:-10} | |
timeline='timeline.json' | |
cat $profile \ | |
| jq '.[] | select(.args.snapshot | . and (type == "string") and contains("/9j"))' \ | |
| jq -s . \ | |
> $timeline |