Skip to content

Instantly share code, notes, and snippets.

View Nooshu's full-sized avatar

Matt Hobbs Nooshu

View GitHub Profile
@joeybaker
joeybaker / cp_export.sh
Last active November 21, 2017 00:22
Export from a couch potato database
# print all the titles in the db
strings -a -t x id_stor | pcregrep -M '[a-z0-9]{1,9}\stitles\[\n[a-z0-9]{1,9}\s(.*?)u$' | grep -v 'titles' | cut -d " " -f 2- | sort | uniq | sed 's/u$//' | sed 's/://' | sed 's/\///' > couchpotato_export.txt
# get all current movies
# note: with GNU sed, the `sed -E` should be `sed -r`
ls /Volumes/raid6/Movies | sed 's/ ([0-9][0-9][0-9][0-9])//' | sed -E 's/(.*), The/The \1/' | sort > movie_files.txt
# get the wanted movies
grep -v -f couchpotato_export.txt movie_files.txt
@NickColley
NickColley / webfonts-are-huge-and-blocking.md
Created December 14, 2018 16:31
GOV.UK Webfonts are huge and blocking

Webfonts are huge and blocking

July 25th, 2016

Webfonts on GOV.UK block initial render and are surprisingly big at 200kb GZIPed

Measured impact

I have measured a 2g/3g connection with fonts blocked to see the difference it could make to lazy-load the font with the following results

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

Notes about tools for measuring and learning about performance.

Tools that can be used

Name + Link Usecase
Google Pagespeed Insights (PSI) Measuring load and render performance, highlighting basic responsive design issues
What does my site cost Measuring how much the payload of a website costs in different countries
Webpagetest Measuring load and render performance, with comprehensive video and waterfall charts, on a choice of devices and connection speeds
Google Lighthouse ("Audits" tab in Chrome Devtools) Measuring load and render performance, and some basic best practice, PWA, and accessibility criteria
@marcysutton
marcysutton / chrome-a11y-experiment-instructions.md
Last active January 31, 2023 22:07
Enable Chrome Accessibility Experiment

NOTE: This is no longer an experiment! You can use the accessibility inspector in Chrome Devtools now, including a fantastic color contrast inspection tool. Read more: https://developers.google.com/web/updates/2018/01/devtools#a11y


Just like any good element inspector helps you debug styles, accessibility inspection in the browser can help you debug HTML and ARIA exposed for assistive technologies such as screen readers. There's a similar tool in Safari (and reportedly one in Edge) but I like the Chrome one best.

As an internal Chrome experiment, this tool differs from the Accessibility Developer Tools extension in that it has privileged Accessibility API access and reports more information as a result. You can still use the audit feature in the Chrome Accessibility Developer Tools, or you could use the aXe Chrome extension. :)

To enable the accessibility inspector in Chrome stable:

@wesbos
wesbos / commit-msg
Created July 4, 2016 18:55
ESLint 3.0 Git Pre Commit Hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.jsx\?$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
failed=0
for file in ${files}; do
@radum
radum / A Web performance resources.md
Last active August 30, 2023 08:11
Web performance resources

Articles

Performance API

// https://github.com/WICG/paint-timing
performance.getEntries();
performance.getEntriesByType('paint');

// Calculate the time it spends to run something
@O-Zone
O-Zone / transitionEnd.js
Last active November 23, 2023 22:43
Get the name of the browsers transitionEnd event. After calling this, window.transitionEnd will contain the browser specific name of the transitionEnd event. This is an extract of EvandroLG's transitionEnd snippet, without all support for testing different elements and using cache.
(function (window) {
var transitions = {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'otransitionend'
},
elem = document.createElement('div');
for(var t in transitions){
@sorenlouv
sorenlouv / cpu-intensive.js
Last active December 19, 2023 06:00
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
}
mySlowFunction(8); // higher number => more iterations => slower
@stevekinney
stevekinney / web-performance.md
Last active January 31, 2024 14:23
Web Performance Workshop

Web Performance

Requirements

Repositories