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 / 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

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 / 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 / settings.json5
Created March 12, 2025 10:12
VS Code Gutter color
{
"workbench.colorCustomizations": {
"editorGutter.background": "#242424" // set to the same as your editor background
}
}
@davestewart
davestewart / 1.by-category.md
Last active June 21, 2024 14:57
Coffee Shop Criteria

Environment

Business

  • location
  • likelihood of going bust

Ambience

  • quietness
@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 / 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 / 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 ');
}
}
});