Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / InteractionsEventTiming.js
Last active September 16, 2023 11:11 — forked from anniesullie/InteractionsEventTiming.js
This gist pokes around with interactions in the EventTiming API. It tries to get the interaction latency, delay, processing time breakdown, type, and target.
View InteractionsEventTiming.js
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)) {
@paulirish
paulirish / install_mosh_locally.sh
Last active April 22, 2022 09:09 — forked from xiaom/install_mosh_locally.sh
install mosh locally (updated june 2017)
View install_mosh_locally.sh
#!/bin/bash
# 2017-06 (paulirish): updated for latest sources
# and incorporated fixes from my comments here: https://gist.github.com/xiaom/8264691#gistcomment-1648455
# 2015-ish (zmil): this script does absolutely ZERO error checking. however, it worked
# for me on a RHEL 6.3 machine on 2012-08-08. clearly, the version numbers
# and/or URLs should be made variables. cheers, zmil...@cs.wisc.edu
set -x
@paulirish
paulirish / devtools-protocol-send-command-and-monitor.md
Last active February 11, 2020 17:42 — forked from jasonLaster/inspector.js
how to issue commands and monitor the devtools protocol
View devtools-protocol-send-command-and-monitor.md

Playing with the protocol

You can send arbitrary commands over the protocol fairly easily.

Main.sendOverProtocol('Emulation.setDeviceMetricsOverride', nexus5XMetrics());
Main.sendOverProtocol("Emulation.clearDeviceMetricsOverride");

// It returns a promise
@paulirish
paulirish / download-node-nightly.sh
Last active October 7, 2018 22:08 — forked from rvagg/install-node.sh
download-node-nightly.sh - simple script to fetch Node.js nightlies on OS X and Linux (x86, x64 & ARM)
View download-node-nightly.sh
#!/bin/bash
# Usage:
# bash download-node-nightly.sh
hasxz=$(which xzcat)
os=$(uname | tr '[A-Z]' '[a-z]')
arch=$(uname -m)
pwd=$(PWD)
View index.html
<head>
...
<meta name="viewport" content="width=device-width">
...
</head>
@paulirish
paulirish / index.html
Created October 20, 2015 01:00 — forked from bhauman/index.html
Dynamic source map test
View index.html
<html>
<head>
<script src="modifyme.js"></script>
</head>
<body>
<h1>Testing source map reloading.</h1>
<h3>Open Dev Tools and look in the console.</h3>
<p>Execute the <code>test_sm()</code> function and follow the source links.</p>
</body>
</html>
View debugger.js
var Chrome = require('chrome-remote-interface')
Chrome({
chooseTab: function(tabs) {
var idx = 0
tabs.forEach(function(tab, i) {
if (tab.url === 'http://localhost:9966/')
idx = i
})
return idx
@paulirish
paulirish / moved.md
Last active October 1, 2015 01:38 — forked from dmethvin/gist:1676346
Breakpoint on access to a property
@paulirish
paulirish / USA_data.js
Created January 8, 2012 21:46 — forked from kforeman/USA_data.js
d3 SVG treemap
View USA_data.js
USA =
{'name': 'data', 'children': [
{'name':'A', 'desc':"Communicable, maternal, perinatal and nutritional conditions", 'children':[
{'name':'A01', 'desc':"Tuberculosis", '90FE':0, '90FL':0, '90FP':.000484, '90F1':.000857, '90F5':.000954, '90F10':.000915, '90F15':.000679, '90F20':.001865, '90F25':.002201, '90F30':.002423, '90F35':.001872, '90F40':.001363, '90F45':.001124, '90F50':.000934, '90F55':.000866, '90F60':.000818, '90F65':.000846, '90F70':.00086, '90F75':.000809, '90F80':.000549, '00FE':0, '00FL':0, '00FP':.000539, '00F1':.001017, '00F5':.000981, '00F10':.000816, '00F15':.000609, '00F20':.001216, '00F25':.001175, '00F30':.001267, '00F35':.000935, '00F40':.000713, '00F45':.000735, '00F50':.000596, '00F55':.000584, '00F60':.000544, '00F65':.000565, '00F70':.000608, '00F75':.000603, '00F80':.000399},
{'name':'A02', 'desc':"HIV/AIDS", '90FE':.023124, '90FL':.002457, '90FP':.023525, '90F1':.098902, '90F5':.103213, '90F10':.06633, '90F15':.078107, '90F20':.142801, '90F25':.114696, '90F30':.122893, '90F35'
@paulirish
paulirish / h5bp-twitter-bootstrap
Created December 5, 2011 21:30 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
View h5bp-twitter-bootstrap
#!/bin/sh
echo "
Cool, let's start.
"
src=$PWD