View log-all-mutations.js
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
// Log all DOM mutations to console. | |
// Modern interpretation of https://github.com/kdzwinel/DOMListenerExtension | |
observer = new MutationObserver(onMutation); | |
observerSettings = { | |
subtree: true, | |
childList: true, | |
attributes: true, | |
attributeOldValue: true, |
View generate-pptr-lh-script-from-json.mjs
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
/** | |
* To use: | |
* Export a Recording panel recording as JSON. Run this: | |
* node generate-pptr-lh-script-from-json.mjs yourjson.json | |
* It'll save a `yourjson.json.pptr.js` | |
* That script is dependent on: | |
* lighthouse@9.5.0-dev.20221024 | |
* puppeteer@19.4.1 | |
* Run that script. It'll save a `flow.report.html`. View that. | |
* It's one of these: https://web.dev/lighthouse-user-flows/ |
View Code.gs
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 pretty quick and rough.. but it works | |
// script.google.com | |
// settings to allow editing the appscript.json | |
// set these two files | |
// then hit Run with function 'run' | |
const all = {}; | |
function run() { |
View InteractionsEventTiming.js
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
const interactionMap = new Map(); | |
function logInteraction(interaction) { | |
const clamp = val => Math.round(val * 100) / 100; // clamp to 2 decimal places | |
console.groupCollapsed(`${interaction.type} interaction`, clamp(interaction.latency)); | |
console.log(`total latency`, clamp(interaction.latency)); | |
console.log('delay:', clamp(interaction.delay)); | |
console.groupCollapsed(`processing time in ${Object.entries(interaction.processingTimes).length} entries:`, clamp(interaction.processingTime)); | |
for (const [e, t] of Object.entries(interaction.processingTimes)) { |
View background-lh.js
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
'use strict'; | |
import fs from 'fs'; | |
import puppeteer from 'puppeteer'; | |
import {navigation} from 'lighthouse/lighthouse-core/fraggle-rock/api.js'; | |
// Run Lighthouse headlessly, just Performance | |
(async function() { | |
const browser = await puppeteer.launch({headless: true}); |
View asciiify-the-canvas.js
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
// works great on about:dino | |
// 1. save this file to your snippets. | |
// 2. load about:dino | |
// 3. evaluate the snippet | |
// 4. hit up arrow to trigger the game. | |
// 5. profit | |
(function() { | |
perfnow = performance.now; |
View thing.js
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
document.body.innerHTML = 'Paste or drop items onto this page. View results in console.'; | |
function getPayload(item) { | |
const kind = item.kind; | |
switch (kind) { | |
case 'string': return new Promise(res => item.getAsString(res)); | |
case 'file': return Promise.resolve(item.getAsFile()); | |
default: throw new Error('unknown item kind! ' + kind); | |
} |
View generate_report.js
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
'use strict'; | |
/* eslint-disable */ | |
const fs = require('fs'); | |
const path = require('path'); | |
const ReportGenerator = require('../../lighthouse-core/report/report-generator'); | |
const jsonPath = __dirname + '/../_json/'; |
View eqt.js
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
// Expected Queueing Time | |
// https://docs.google.com/document/d/1Vgu7-R84Ym3lbfTRi98vpdspRr1UwORB4UV-p9K1FF0/edit | |
// Initial impl by Nicolás Peña (npm), Tim Dresser (tdresser) | |
// Usage: | |
// var eqt = EQT.begin(); | |
// // ... | |
// const {expectedQueueingTime} = EQT.end(); | |
class EQT { | |
constructor() { |
View log-the-datatransfer-data.js
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
document.body.innerHTML = 'Paste or drop items onto this page. View results in console.'; | |
function getPayload(item) { | |
const kind = item.kind; | |
switch (kind) { | |
case 'string': return new Promise(res => item.getAsString(res)); | |
case 'file': return Promise.resolve(item.getAsFile()); | |
default: throw new Error('unknown item kind! ' + kind); | |
} |
NewerOlder