Skip to content

Instantly share code, notes, and snippets.

View rviscomi's full-sized avatar

Rick Viscomi rviscomi

View GitHub Profile
{
"offscreenscore": [
"0.0",
"0.0",
"0.0",
"0.0",
"0.0",
"0.0",
"0.03",
"0.13",
@rviscomi
rviscomi / 01_01.nljson
Last active July 24, 2019 20:51
Example of Web Almanac metric
{"volume":"161778","kbytes":"0","pdf":"0.037003430716520895","cdf":"0.037003430716520895"}
{"volume":"41534","kbytes":"10","pdf":"0.0095000586691637856","cdf":"0.046503489385684681"}
{"volume":"22318","kbytes":"20","pdf":"0.0051047890734915334","cdf":"0.051608278459176211"}
{"volume":"33100","kbytes":"30","pdf":"0.0075709525196061365","cdf":"0.059179230978782346"}
{"volume":"45611","kbytes":"40","pdf":"0.010432589588270558","cdf":"0.0696118205670529"}
{"volume":"50755","kbytes":"50","pdf":"0.011609175079535029","cdf":"0.081220995646587926"}
{"volume":"50951","kbytes":"60","pdf":"0.011654006097475899","cdf":"0.092875001744063823"}
{"volume":"54638","kbytes":"70","pdf":"0.012497332440067677","cdf":"0.1053723341841315"}
{"volume":"59040","kbytes":"80","pdf":"0.013504200506270282","cdf":"0.11887653469040178"}
{"volume":"60605","kbytes":"90","pdf":"0.013862162460747127","cdf":"0.13273869715114892"}
{
"type": "stylesheet",
"stylesheet": {
"rules": [
{
"type": "comment",
"comment": "! jQuery UI - v1.9.2 - 2012-11-23\n* http://jqueryui.com\n* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css\n* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT ",
"position": {
"start": {
"line": 1,
@rviscomi
rviscomi / crux-cls.sql
Created June 17, 2019 17:10
Query for cumulative layout shifts in the Chrome UX Report
SELECT
form_factor.name AS form_factor,
cls.start,
ROUND(SUM(cls.density), 4) AS density
FROM
`chrome-ux-report.all.201905`,
UNNEST(experimental.cumulative_layout_shift.histogram.bin) AS cls
WHERE
origin = 'https://www.nytimes.com'
GROUP BY
@rviscomi
rviscomi / summary_requests.sql
Last active July 22, 2019 15:15
Takes a HAR-based requests table and converts it into a CSV-style summary_requests table
CREATE TEMPORARY FUNCTION getSummary(payload STRING, crawlid INT64)
RETURNS STRUCT<requestid INT64, pageid INT64, startedDateTime INT64, time INT64, method STRING, url STRING, urlShort STRING, redirectUrl STRING, firstReq BOOLEAN, firstHtml BOOLEAN, reqHttpVersion STRING, reqHeadersSize INT64,
reqBodySize INT64, reqCookieLen INT64, reqOtherHeaders STRING, status INT64, respHttpVersion STRING, respHeadersSize INT64, respBodySize INT64, respSize INT64, respCookieLen INT64, expAge INT64, mimeType STRING, respOtherHeaders STRING,
req_accept STRING, req_accept_charset STRING, req_accept_encoding STRING, req_accept_language STRING, req_connection STRING, req_host STRING, req_if_modified_since STRING, req_if_none_match STRING, req_referer STRING, req_user_agent STRING,
resp_accept_ranges STRING, resp_age STRING, resp_cache_control STRING, resp_connection STRING, resp_content_encoding STRING, resp_content_language STRING, resp_content_length STRING, resp_content_location STRING, resp_content_type STRING, resp_date ST
@rviscomi
rviscomi / CrashCourseInCrUX.md
Last active May 7, 2019 10:52
"Crash Course in CrUX" for the PerfMatters conference, April 2019
<script type="application/ld+json">
[
{
"@context": "http://schema.org/",
"@type": "Event"
},
{
"@context": "http://schema.org/",
"@type": "Recipe"
}
@rviscomi
rviscomi / multi <--> single
Created June 3, 2018 18:47
Convenience functions for turning a multi-line string into concatenated single-line strings and back
concat = q => q.split('\n').map(l => `"${l}"`).join('+\n');
multi = q => q.split('\n').map(l => l.replace(/(^"|"\+$)/g, '')).join('\n');
https://www.slideshare.net/jrvis/the-state-of-performance-in-the-wordpress-ecosystem