Skip to content

Instantly share code, notes, and snippets.

View patrickhulce's full-sized avatar
😎
Live, eat, breathe JS

Patrick Hulce patrickhulce

😎
Live, eat, breathe JS
View GitHub Profile
@patrickhulce
patrickhulce / find-diffs.js
Last active February 7, 2020 13:18
Lighthouse CI Get Diffs For Hashes (DISCLAIMER: untested)
const ApiClient = require('@lhci/utils/src/api-client')
const {findAuditDiffs} = require('@lhci/utils/src/audit-diff-finder')
const client = new ApiClient({rootURL: 'http://lhci-server.example.com'})
const PROJECT_ID = '<UUID of project>'
async function getLHR(hash, url) {
const [build] = await client.getBuilds(PROJECT_ID, {hash})
const [run] = await client.getRuns(PROJECT_ID, build.id, {representative: true, url})
@patrickhulce
patrickhulce / lighthouse-v4.json
Created April 18, 2019 03:10
Lighthouse v4 JSON report.
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3768.3 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3768.3 Safari/537.36",
"benchmarkIndex": 986
},
"lighthouseVersion": "4.3.0",
"fetchTime": "2019-04-18T03:10:00.727Z",
"requestedUrl": "https://example.com/",
@patrickhulce
patrickhulce / third-parties.sql
Last active June 13, 2021 08:57
third party SQL manipulation
This file has been truncated, but you can view the full file.
/** Forked from https://gist.github.com/simonhearne/2d090a797da9beabe5ee21cf9cd0bf84 */
CREATE TABLE IF NOT EXISTS `thirdpartydb_group` (idgroup INTEGER PRIMARY KEY AUTOINCREMENT, name text);
CREATE TABLE IF NOT EXISTS `thirdpartydb_category` (idcategory INTEGER PRIMARY KEY AUTOINCREMENT, name text, groupid INT);
CREATE TABLE IF NOT EXISTS `thirdpartydb_company` (idcompany INTEGER PRIMARY KEY AUTOINCREMENT, name text);
CREATE TABLE IF NOT EXISTS `thirdpartydb_product` (
idproduct INTEGER PRIMARY KEY AUTOINCREMENT,
@patrickhulce
patrickhulce / big-query-lighthouse.sql
Created July 18, 2018 16:15
HTTP Archive Lighthouse Queries
/* Get the distribution of performance scores */
SELECT
QUANTILES(FLOAT(JSON_EXTRACT_SCALAR(report, '$.categories.performance.score')), 21)
FROM
[httparchive:lighthouse.2018_07_01_mobile]
WHERE
report != 'null'
AND JSON_EXTRACT(report, '$.categories.performance.score') != 'null'
/* Get the distribution of FCP values */
@patrickhulce
patrickhulce / mac-setup.md
Last active January 8, 2024 16:44
Macbook Setup

setup steps

  1. Show battery percentage (now in control center prefs)

  2. Enable tap click, right click

  3. Hide dock

  4. Uncheck "close Windows when quitting an application"

  5. Update device name in Preferences > Sharing

  6. Install homebrew (installs xcode command line utils)

  7. Install Terminal

@patrickhulce
patrickhulce / express-proxies.md
Created March 20, 2018 21:21
express proxy settings
@patrickhulce
patrickhulce / tasks-and-queues.js
Created December 18, 2017 22:02
See scheduling of callbacks/microtasks/tasks
(() => {
console.log('script start');
setTimeout(function() {
console.log('setTimeout');
}, 0);
// Edge/IE only
// setImmediate(function() {
// console.log('setImmediate');
@patrickhulce
patrickhulce / go.js
Created July 28, 2017 00:44
Remote DevTools expensive layout
const fs = require('fs')
const CDP = require('chrome-remote-interface')
let traceStr = ''
let allEvts = [];
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
<html>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<body>
Just try and figure out my TTCI (hint: it should be NEVER)<br>
This is a test to ensure we properly handle PerformanceObserver lifecycle, see
<a href="https://crbug.com/742530">https://crbug.com/742530</a>
<script>
/**
* Stalls the main thread for timeInMs
*/
@patrickhulce
patrickhulce / layout-instability.html
Created May 9, 2017 16:53
Simulated ads loading above article content
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body, h1 {
margin: 0;
font-size: 150%;
}
.elem {