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
#(vals (group-by type %)) |
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
(function trackOnClickFPS() { | |
window.dataLayer = window.dataLayer || []; | |
var start = performance.now(); | |
var end = start; | |
var diff = 0; | |
var page = ""; | |
var frameCount = 0; | |
var frcurr = start; | |
var frprev = start; | |
var frdiff = 0; |
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
#!/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 |
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
/* Started from https://andydavies.me/blog/2020/09/22/exploring-site-speed-optimisations-with-webpagetest-and-cloudflare-workers */ | |
const site = 'www.gymshark.com' | |
addEventListener('fetch', (event) => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const url = new URL(request.url) |
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
# How it works: They're just base64'd with a small header at the start | |
# Trim the header + decode and there you have it! | |
# (just make sure you're using the appropriate file type) | |
# macOS | |
pbpaste | sed 's#data[^,]+,##' | base64 -d > image.png | |
open image.png | |
# Linux (IIRC) | |
xclip -sel clipboard -o | sed 's#data[^,]+,##' | base64 -d > image.png |
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
addEventListener('fetch', (event) => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
const sleep = ms => new Promise(r => setTimeout(r, ms)); | |
async function handleRequest(request) { | |
const url = new URL(request.url) | |
// Disallow crawlers |
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
#!/usr/bin/env bash | |
file=$1 | |
n=$2 | |
if [[ $# -lt 2 ]]; then | |
cat <<- EOD | |
Usage: $0 <path> <number_of_files> | |
EOD | |
fi |
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 code is a vectorized R version of the Lighthouse scoring code | |
# that you can find here: | |
# https://github.com/GoogleChrome/lighthouse/blob/9e0e9dfb67a3dd38b611b02d1129b197da8a2b0c/lighthouse-core/lib/statistics.js#L75-L97 | |
INVERSE_ERFC_ONE_FIFTH <- 0.9061938024368232 | |
erf <- function(x) { | |
s <- sign(x) | |
x <- abs(x) | |
a1 <- 0.254829592 |
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
console.log(top); | |
console.log(top.opener); |