Skip to content

Instantly share code, notes, and snippets.

View GrahamLea's full-sized avatar

Graham Lea GrahamLea

View GitHub Profile
@GrahamLea
GrahamLea / carrd_google_analytics_scroll_depth.html
Created October 16, 2019 06:52
HTML/JS embed source to get a Carrd web page logging scroll depth events to Google Analytics (should work for any website loading GA via https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-X)
<script>
// TODO: Replace the percentages and names below with those relevant to your website
var percentagesToReport = new Map();
percentagesToReport.set(25, 'Section2');
percentagesToReport.set(50, 'Section3');
percentagesToReport.set(75, 'Section4');
percentagesToReport.set(90, 'Section5');
function reportScroll(scrollLocationName) {
gtag('event', scrollLocationName, {
@GrahamLea
GrahamLea / docker-cleanup.sh
Created May 20, 2020 13:57
How to cleanup docker containers, images and volumes on your local machine
# Remove containers whose name matches the automatic naming pattern (adjective_name). Won't affect running containers.
docker rm $(docker ps -a | awk '{print $NF}' |egrep '^[a-z]+_[a-z]+$')
# Delete images that don't have any tags or containers.
docker image prune -f
# Delete unused volumes
docker volume prune -f
@GrahamLea
GrahamLea / Mastodon_Follow_Locally_Mod_TamperMonkey.js
Created December 17, 2022 04:49
A TamperMonkey script for Mastodon that makes it easy to jump from looking at someone's profile on another server to following them on your server
// ==UserScript==
// @name Mastodon Follow Locally Mod
// @namespace http://www.grahamlea.com/
// @version 0.1
// @description Allows you to follow Mastodon accounts from other servers more easily
// @author Graham Lea (@evolvable@aus.social)
// @match https://*/*
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==