Skip to content

Instantly share code, notes, and snippets.

@pixelthing
pixelthing / GA4-spash-favelet.js
Created May 13, 2022 14:09
Browser favelet for re-colouring Google Analytics 4 exploration graphs
javascript:(function () { const swaps = { '1f4495' : 'e6194B', '2f5ec4' : 'f58231', '356fdb' : 'ffe119', '4285f4' : 'bfef45', '4495f2' : '3cb44b', '45a5f5' : '42d4f4', '68bced' : '4363d8', '93d5ed' : '911eb4', 'bde9f2' : 'f032e6', 'dcf7fa' : 'a9a9a9', 'd0e5f5' : '800000', 'c0cef6' : '9A6324', 'b3baf7' : '808000', 'a6a7f9' : '469990', '968efa' : '000075', '8473f9' : 'fabed4', '765ee5' : 'ffd8b1', '694bd3' : 'fffac8', '5432b6' : 'aaffc3', '3f18a3' : 'dcbeff', }; for (const existingColour in swaps) { const replacementColour = swaps[existingColour]; const strokes = document.querySelectorAll(`[stroke="#${existingColour}"]`); if (strokes) { strokes.forEach(d => { d.setAttribute('stroke','#' + replacementColour) }); } const fills = document.querySelectorAll(`[fill="#${existingColour}"]`); if (fills) { fills.forEach(d => { d.setAttribute('fill','#' + replacementColour) }); } };})();
@pixelthing
pixelthing / gds-999.js
Created December 15, 2021 13:27
Browser favelet to rewrite all values in a GDS dashboard to 999.9
javascript:(() => {let allValues = document.querySelectorAll('.valueLabel,.barCell span,.cell-value, .data-cell, .compareLabel, .cell:not(.barCell)');allValues.forEach((el) => { let content = el.innerText; let contentArray = content.split(''); let contentArray2 = contentArray.map(letter => {return (Number.isNaN(parseInt(letter)) ? letter : %279%27)}); let content2 = contentArray2.join(%27%27); if (content !== content2) { let elInner = el.querySelector(%27span%27); if (elInner) { elInner.innerText = content2; } else { el.innerText = content2; } }})})()
// JS SCRIPT TO USE WITH SCRIPTABLE APP + iOS14+ WIDGETS
//
// Requires Scriptable1.5+ and iOS14/iPadOS14
//
// Download and install Scriptableapp https://scriptable.app
// Add this script into Scriptable, then add a scriptable widget to your homescreen
// (only the smallest size has been tested), hold down on the widget, then tap "edit widget",
// select *this* script as the "Script File", and in the *Parmameter* input, paste in
// the API key you use to allow access to the data feed.
@pixelthing
pixelthing / raspberry4.md
Last active July 9, 2020 16:49
Raspberry Pi 4 dashboard notes

Differences when installing on a Pi4B 4Gb (as oppose to my previous installs on a 3B):

using a raspberry pi as a wifi network access point + web server. so i can work on the ipad with a mini offboard web server with no internet connection at all.

setting up the rpi as a network access point hbut do not carry out the bridge instructions): https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

setting up a VNC server: https://www.raspberrypi.org/documentation/remote-access/vnc/ (you can get it working straight on ipad away with the realvnc client (it uses unix authentication), but the realvnc interface is ... interesting ... so i downgraded to vnc authentication so that i could use "screens" app instead.

out there:

@pixelthing
pixelthing / raspberry-pi-dashboard.md
Last active March 29, 2022 07:07
Rasepberry Pi dashboard set-up list

READY RASPBERRY PI DASHBOARD

You will need

  • Monitor with DVI (or use a diff cable with outher connections) and ability to rotate 90deg. A 24" 16:10 Dell widescreen is perfect. A Dell 16:9 27" is even better.
  • *Raspberry Pi starter kit
    • Raspberry Pi 3b+ (a Pi 4 of 2GB or more is even better).
    • EU/UK power supply (just a 5W microUSB - but a Pi4 needs higher wattage USB-C power)
    • Raspberry Pi case (clear plastic so far)
    • Rasbarry Pi NooB Linux microSD card
  • Amazon Basics 0.9m/3ft HDMI to DVI adapter Cable (for a Pi4, you'll need a much rarer micro-HDMI to DVI)
@pixelthing
pixelthing / codepen.ipad.css
Last active March 28, 2019 16:39
Making codepen.io a little more iPad friendly. @pixelthing
/*
Making codepen.io a little more iPad friendly. @pixelthing
First - I hope this doesn't come across as being a bit of an dick. I massively appreciate
CodePen and know the huge amount of pressure that comes from every direction in a project this
big, so totally understand that not every user experience can be addressed with the time and
resources available. Think of this as a pull request for your consideration.
*Do not feel the need to pity-implement anything or let me down gently. It's your site, not mine.*
This is a shim to add to the CodePen editor styles (eg, greasemonkey style).

WORK IN PROGRESS!! OPEN TO STENDAHLS EMPLOYEES TO CONTRIBUTE TO.

Stendahls policy on ethics and analytics.

Stendahls commits to continuously implement and review an ethical analytics strategy, not aiming for legal compliance, but aiming for an ethical, open and trusting enviroment for our employees, clients and the end-consumers involved in any of our services.

Analytics can be a powerful positive force in understanding and improving customer experience, as well checking misinterpretations and privilege about users and their interaction with our services. It can also provide our clients with a way of understanding and improving the value (both monetary and experiential) of the services Stendahls provide them.

Analytics usage can however also undermine the user's privacy and therefore contribute to an industry-wide breakdown in consumer trust. Stendahls takes responsibility in trying to maximise the positive benefits to end-consumers, without neglecting (or exacerbating) the impact of the negative.

@pixelthing
pixelthing / iphonex-8-landscape.txt
Last active September 25, 2017 19:14
iPhone 6/7/8/X viewport sizes and 100vh - landscape
╔══════════════╦═══════════╦═══════════╦══════════════╦═════╗
║ Landscape ║ Window ║ Document ║ UI Chrome ║ ║
╠══════════════╬═════╦═════╬═════╦═════╬════╦════╦════╣100vh║
║ ║ X ║ Y ║ X ║ Y ║top ║bot ║all ║ ║
╠══════════════╬═════╬═════╬═════╬═════╬════╬════╬════╬═════╣
║ 8 full UI ║667px║375px║667px║325px║50px║0px ║50px║-50px║
║ 8 scrolled ║667px║375px║667px║375px║0px ║0px ║0px ║ yes ║
╠══════════════╬═════╬═════╬═════╬═════╬════╬════╬════╬═════╣
║ 8+ full UI ║736px║414px║736px║364px║50px║0px ║50px║-50px║
║ 8+ scrolled ║736px║414px║736px║414px║0px ║0px ║0px ║ yes ║
@pixelthing
pixelthing / iphonex-8-portrait.txt
Last active December 3, 2018 20:43
iPhone 6/7/8/X viewport sizes and 100vh - portrait
╔══════════════╦═══════════╦═══════════╦═══════════════╦══════╗
║ Portrait ║ Window ║ Document ║ UI Chrome ║ ║
╠══════════════╬═════╦═════╬═════╦═════╬════╦════╦═════╣100vh ║
║ ║ X ║ Y ║ X ║ Y ║top ║bot ║ all ║ ║
╠══════════════╬═════╬═════╬═════╬═════╬════╬════╬═════╬══════╣
║ 8 full UI ║375px║667px║375px║553px║70px║45px║115px║-75px ║
║ 8 scrolled ║375px║667px║375px║627px║40px║0px ║40px ║ yes ║
╠══════════════╬═════╬═════╬═════╬═════╬════╬════╬═════╬══════╣
║ 8+ full UI ║414px║736px║414px║621px║70px║45px║115px║-75px ║
║ 8+ scrolled ║414px║736px║414px║696px║40px║0px ║40px ║ yes ║