Skip to content

Instantly share code, notes, and snippets.

View davestewart's full-sized avatar
⚙️
Workin' on Chrome extensions!

Dave Stewart davestewart

⚙️
Workin' on Chrome extensions!
View GitHub Profile
@davestewart
davestewart / README.md
Last active April 3, 2026 08:24
Decompile JavaScript from source maps

Decompile JavaScript from source maps

Overview

Modern JavaScript build tools compile entire folder structures of JavaScript code into single, minified files that are near-impossible to read, but can also include source maps which can be used to display the original code in tools such as the Chrome DevTools Sources panel.

These source maps can be processed to extract mainly meaningful code and file structures, by installing a package calling Shuji and running a simple bash command.

Generally, production builds shouldn't include source maps, but if you do manage to lose your source files, or for some (obviously, ethical!) reason need to view the original files, and you happen to have / find the source maps, you're good to go.

@davestewart
davestewart / estimation.md
Last active March 1, 2026 06:30
Things to think about when estimating frontend projects

Estimation

This document is an attempt to pin down all the things you don't think about when quoting for a project, and hopefully provide a starting point for some kind of framework to make quoting, working and delivering small-medium jobs more predictable and less stressful.

Contents

@davestewart
davestewart / TextFieldController.as
Last active January 22, 2026 14:16
Flash TextFieldController class
package text
{
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
/**
* Class to manage a TextField instance and reduce its fontsize to ensure it stays within its original dimensions
* @author Dave Stewart
@davestewart
davestewart / CAPSSUCK.js
Last active January 22, 2026 12:31
Convert CAPS CASE to Sentence case bookmarket
javascript: document.querySelectorAll('*').forEach(e => {
if (e.childNodes.length === 1 && e.childNodes[0].nodeType === Element.TEXT_NODE) {
if (e.innerText && e.innerText === e.innerText.toUpperCase()) {
e.innerText = e.innerText.toLowerCase()
.replace(/^\w|\.\s+\w/gm, t => t.toUpperCase())
.replace(/\si\s/, ' I ');
}
}
});
@davestewart
davestewart / formatting-test.md
Last active January 22, 2026 12:18
Syntax highlighting test

feature

layers/my-layer/
  entrypoints/          # Same as WXT
    background.ts
    popup.html
    content.ts
  composables/          # Auto-imported (if enabled)
  components/           # Auto-imported (if enabled)
  hooks/                # Auto-imported (if enabled)
@davestewart
davestewart / excel - copy columns.vba
Last active January 22, 2026 12:12
Excel "copy columns" macro
Type Region
src As Range
col As Long
End Type
Sub Copy_Columns()
'
' This Excel macro copies columns from a <source> sheet to a <target> sheet:
'
' - by default, sheets 1 and 2 will be used as <source> and <target>
@davestewart
davestewart / package-wiki.md
Last active January 22, 2026 12:12
Package Wiki experiment

Package Wiki

This file documents Metalink Frontend's package.json in a human-readable manner designed to make it easy for contributors to see how related units work together.

Units are ordered by Dependency Type > Category > Group, then listed with Titles, Descriptions, Links and Notes.

Please edit or improve the sections and descriptions as required, then keep this document up to date.

Dependencies

@davestewart
davestewart / gup.bash
Last active December 14, 2025 10:59
GitHub update and force-push only changed files from previous commit (add to your bash profile and run as `gup`)
# Git Update-and-Push (gup)
# Amends the last commit with any changes to files included in that commit and force-pushes the updated commit.
# Usage:
# gitup # Amend last commit with changes to files in that commit and force-push
# gitup -s # Show status of files in last commit without amending; 🔥 indicates changes
gup() {
# Check for flags
local status_only=false
if [[ "$1" == "-s" || "$1" == "--status" ]]; then
@davestewart
davestewart / conventional-commits.bash
Last active December 7, 2025 19:39
Conventional Commits setup
npm install --save-dev husky @commitlint/cli @commitlint/config-conventional
npx husky init
echo 'export default {\n extends: ["@commitlint/config-conventional"]\n}' > commitlint.config.js
echo 'npx --no -- commitlint --edit $1' > .husky/commit-msg
chmod +x .husky/commit-msg
@davestewart
davestewart / Layer Comps To Files.jsx
Last active August 2, 2025 08:10
Updated Photoshop "Layer Comps To Files.jsx" with optional numeric prefixing and improved file name formatting
// Copy to: "C:\Program Files (x86)\Creative\Adobe Photoshop CS6\Presets\Scripts" or equivilent on a Mac
// Tested with Photoshop CS6, but should work with older versions. Backup existing files before copying over them!
// Copyright 2007. Adobe Systems, Incorporated. All rights reserved.
// This script will apply each comp and then export to a file
// Written by Naoki Hada
// ZStrings and auto layout by Tom Ruark
// PNG support by Jeffrey Tranberry
/*