Skip to content

Instantly share code, notes, and snippets.

/opt/google/chrome --log-net-log="/home/andy/netlog.txt" --net-log-capture-mode=IncludeSensitive --allow-pre-commit-input --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --enable-automation --enable-blink-features=IdleDetection --enable-features=NetworkServiceInProcess2 --export-tagged-pdf --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain
@andydavies
andydavies / jsk.c
Created February 4, 2022 10:19 — forked from kdzwinel/jsk.c
JSK -JPEG Scan Killer
/*
* jsk.c
*
* Copyright (C) 2013, Frederic Kayser.
*
*/
#include <stdio.h>
#include <stddef.h>
@andydavies
andydavies / cleanPage.js
Created February 9, 2021 15:23
DevTools snippet to remove the document contents and any event handlers on document and window objects
document.documentElement.innerHTML = '';
for (const obj of [document, window]) {
for (const event of Object.values(getEventListeners(obj))) {
for (const {type, listener, useCapture} of event) {
obj.removeEventListener(type, listener, useCapture)
}
}
}
@andydavies
andydavies / index.js
Created January 14, 2021 12:08
Example Cloudflare Worker that removes script preloads
/*
* For more detail see https://andydavies.me/blog/2020/09/22/exploring-site-speed-optimisations-with-webpagetest-and-cloudflare-workers/
* Started from Pat's example in https://www.slideshare.net/patrickmeenan/getting-the-most-out-of-webpagetest
*
* Change site to be site you want to experiment with
*/
const site = 'www.example.com';
async function handleRequest(request) {
@andydavies
andydavies / kill-vwo-anti-flicker-styles.js
Created December 18, 2020 10:42
Uses a Mutation Observer to detect when VWO injects it's anti-flicker styles into the page and them removes them - handy for WPT
callback = function(mutationsList, headObserver) {
// Use traditional 'for loops' for IE 11
for(mutation of mutationsList) {
for(node of mutation.addedNodes) {
if(node.nodeName === 'STYLE' && node.id === '_vis_opt_path_hides') {
node.parentNode.removeChild(node);
performance.mark('vwo-hide-start');
}
@andydavies
andydavies / index.html
Created November 25, 2020 10:39 — forked from 3urdoch/index.html
TCF2.0 Compliant approach to loading Google Ad Manager, Prebid and Amazon APS tags that prevents TCV2.1a errors
<!doctype html>
<html lang="en">
<head>
</head>
<body>
<!-- Quantcast CMP, pasted un-modified from Quantcast interface -->
<script type="text/javascript" async=true>
(function() {
var host = window.location.hostname;
@andydavies
andydavies / keyworksFromUrl.js
Created July 27, 2020 07:56 — forked from johnmurch/keywordsFromUrl.js
Parse keywords from URL
let url = "https://www.amazon.com/SanDisk-128GB-microSDXC-Memory-Adapter/dp/B073JYC4XM/";
let kwparse = (url.replace('https://','').replace('http://','').replace('www','').replace('com','').split('-').join().split('/').join().split('.')).join(',').replace(/^,/, '')
let kwuniq = [...new Set(kwparse.split(','))].filter(function(e){return e});
console.log(kwuniq)
sub vcl_recv {
#FASTLY recv
# We don't do other methods
if (req.method != "GET") {
return(error);
}
# Handle IPv4 or IPv6 provided in url path (nothing extraneous allowed, perform basic matching)
if (req.url.path ~ "^/([a-f0-9:.]+)$") {
set client.geo.ip_override = re.group.1;

Depending on where you are on your Data Viz journey, I'd probably start with Dona Wong or Cole Knaflic, then Andy Kirk, then Kopenen & Hildén (once I've read K&H I might swap the last two around)

Cairo's books are nice interlude and Few's is quite heavy weight (in both senses) though useful for dashboard design

(Amazon links are associate ones so feel free to buy elsewhere e.g. Hive in the UK)

The Wall Street Journal Guide to Information Graphics: The Dos and Don'ts of Presenting Data, Facts, and Figures, Dona Wong Amazon.com

Storytelling with Data: A Data Visualization Guide for Business Professionals Paperback, Cole Knaflic

@andydavies
andydavies / Beef and Ale Stew.md
Last active November 22, 2018 17:17
Beef and Ale Stew

Ingredients

  • Bottle of beer - I used Abbot this time but can be Guinness, Black Sheep, what ever takes your fancy
  • Knorr beef stock pot
  • Bay leaves
  • Black pepper
  • Carrots - 1 to 1 1/5 per person depending on size
  • Large onion or a couple of medium ones
  • 3 - 4 cloves of garlic
  • Shallots (bag off)
  • Lean stewing beef - 400g ish