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

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 / README.md
Last active April 8, 2024 11:00
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 / broadcast-channel.md
Last active April 1, 2024 16:47
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot

@davestewart
davestewart / prepare_csv.vba
Last active March 31, 2024 15:43
Prepare Barclays CSV
Sub Prepare_CSV()
'
' Prepare Barclays bank CSV export
'
' - formats number, date and amount columns
' - splits memo column
' - trims resulting cells
' - consolidates amazon payees
' - copies data to clipboard
'
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 / workflowy x 2.js
Last active February 20, 2024 16:25
WorkFlowy x 2 - a browser bookmarklet to give you a dual panel WorkFlowy view
javascript:
`
WorkFlowy x 2
=============
- A browser Bookmarklet to give you a dual panel WorkFlowy view
Features / Usage:
@davestewart
davestewart / emojis.md
Last active December 5, 2023 13:37
An attempt to categorise emojis by emotional group
group name emojis
positive
winning 🥳😎🤩🤑🤓🤠😇🫡
cheeky 😏😉😋😛😝😜🤪
happy 🙂🙃😀😃😁😄😆😅😂🤣
content 😌☺️😊🤗🥰
amorous 😗😙😚😘😍
neutral
shy 🫢🤭
@davestewart
davestewart / Layer Comps To Files.jsx
Last active December 1, 2023 15:47
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
/*
@davestewart
davestewart / test.js
Last active November 10, 2023 09:21
.filter().map() pedantry!
let values = []
let scores = []
function prepare (length = 10_000_000) {
values = (new Array(length)).fill(1).map((e, i) => i)
}
function forIn () {
const output = []
for (let i = 0; i < values.length; i++) {
@davestewart
davestewart / CAPSSUCK.js
Created November 9, 2023 13:45
Convert CAPS CASE to Sentence case
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 ');
}
}
});