Skip to content

Instantly share code, notes, and snippets.

@gatebuildr
gatebuildr / Markdown Todo Toggle.ahk
Last active July 19, 2025 20:31
Hotkey to quickly create or toggle checkboxes when editing markdown
; Default binding is ctrl+[
; Selects everything before the cursor, figures out if it's a checkbox or not, changes
; the beginning of the line, and lands you back where you started. Those changes are:
; - Existing checkboxes get toggled on or off
; - Existing list items get turned into checklist items
; - Plain text lines with no prefix and blank lines are turned into checklist items
; Indentation is preserved in all cases.
; By all means redo this in AHK2 and link to it. I ain't got time to learn that.
@gatebuildr
gatebuildr / podchaser-userscript.js
Created May 10, 2023 00:06
Some extra features for Podchaser, specifically focused on hiding podcasts you're not interested in
// ==UserScript==
// @name Podchaser Basic Usability Fixes
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.podchaser.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=podchaser.com
// @grant GM_addStyle
// @require https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js
@gatebuildr
gatebuildr / waitForIt.js
Last active October 12, 2024 19:39 — forked from lndr27/waitForIt.js
JS Wait for condition promise
(function (window) {
window.waitForIt = (predicate, options) => {
if (typeof predicate !== 'function') {
throw new Error('predicate must be a function')
}
return new Promise((resolve, reject) => {
_waitForTryAgain({
resolve,
reject,
@gatebuildr
gatebuildr / setReactInputValue.js
Last active October 19, 2024 02:46
Helper function to change the value of an input element created by React. Changes the value using React's custom setter.
(function(window) {
// This shit is necessary because react replaces the native setter for 'value' on inputs, so we can't just change the value in the DOM.
// Instead we grab the setter function and call it with reflection. It's EMBARRASSINGLY slow.
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
function setReactInputValue(input, value) {
nativeInputValueSetter.call(input, String(value));
input.dispatchEvent(new Event('input', {bubbles: true}));
}
window.setReactInputValue = setReactInputValue;