Skip to content

Instantly share code, notes, and snippets.

// run a breadth-first search, logging all matches to the console along with the path followed to get there.
// this is designed for interactive use in e.g. browser dev console,
// I use it when i'm writing userscripts to look for places where certain data is exposed through the global scope
// by amgg.
// license: you can do whatever you want forever
function BFS(root, predicate, { traversers = null, chunk_size = 512, verbose = false } = {}) {
// populate default options
traversers ??= [BFS.traversers.key_via_reflect];
@twilight-sparkle-irl
twilight-sparkle-irl / pollview.js
Last active July 18, 2025 19:37
view poll percentages on tumblr (for pasting into JS console)
// get randomly generated string for react elements
var suffix = Object.keys(document.querySelector('#base-container'))[0].split('$')[1]
var reakt = (x)=>`__react${x+'$'+suffix}`
// get current clicked-on post (clicked on OP's url on the dashboard, or went to direct www.tumblr.com link)
var tlo = document.querySelector('[data-testid="timelinePosts"] [data-id]')[reakt`Fiber`].child.child.child.memoizedProps.timelineObject
var poll = tlo.content.filter(x=>x.type=='poll')[0] // get first poll in post
// grab the results for the poll
tumblr.apiFetch(`/v2/polls/${tlo.blogName}/${tlo.idString}/${poll.clientId}/results`).then(function (results) {
let output = []
@twilight-sparkle-irl
twilight-sparkle-irl / poll-unlocker.user.js
Last active February 5, 2023 05:46
unlock polls on tumblr (click the Raw button with Tampermonkey installed!)
// ==UserScript==
// @name Poll Unlocker
// @version 0.1
// @description gives u polls
// @author Twilight Sparkle
// @license MIT
// @match https://www.tumblr.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tumblr.com
// @grant none
// @run-at document-start
@AbstractUmbra
AbstractUmbra / 00-deprecation.md
Last active October 26, 2025 12:01
discord.py 2.0+ slash command info and examples

This gist has now been 'deprecated' and has moved...

... to my blog style space for easier contribution by third parties and to provide what I believe to be an easier reading experience. Please field all enquiries and issues to the source repository.

@kkrypt0nn
kkrypt0nn / ansi-colors-discord.md
Last active November 30, 2025 20:59
A guide to ANSI on Discord

A guide to ANSI on Discord

Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.

Quick Explanation

To be able to send a colored text, you need to use the ansi language for your code block and provide a prefix of this format before writing your text:

\u001b[{format};{color}m
function createElementHelper(tagName, {style:{vars:styleVars={}, ...style}={}, attrs={}, events={}, classList=[], children=[], parent=null, insertBefore=null, ...props}={}) {
let elem = document.createElement(tagName);
for(let k in style) elem.style[k] = style[k];
for(let k in styleVars) elem.style.setProperty(k, styleVars[k]);
for(let k in attrs) elem.setAttribute(k, attrs[k]);
for(let k in events) elem.addEventListener(k, events[k]);
if(classList.length > 0) elem.classList.add.apply(elem.classList, classList);
for(let k in props) elem[k] = props[k];
for(let c of children) elem.appendChild(c);
if(parent !== null) {
@luuk00000000000000000000000000000000000
luuk00000000000000000000000000000000000 / tutorial.md
Last active October 13, 2025 20:09
This is a tutorial on how you can backup and restore your Discord favorite gifs (on windows)

This won't work anymore because Discord moved to cloud storage for the gifs

Backup

  1. Open Discord.
  2. Press CTRL, SHIFT and I on your keyboard at the same time.
  3. In the newly opened window, at the top, click the >> button, and then click on Application.
    Image 1
  4. Once in the Application tab, click the little triangle next to Local Storage, and then click on https://discordapp.com.
    Image 2
if(!(Get-Command git -ErrorAction SilentlyContinue)) {
$gitDir = "$env:LOCALAPPDATA\CustomGit"
if(Test-Path $gitDir) { Remove-Item -Path $gitDir -Recurse -Force }
New-Item -Path $gitDir -ItemType Directory
$gitLatestReleaseApi = (Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/git-for-windows/git/releases/latest).Content | ConvertFrom-Json
$mingitObject = $gitLatestReleaseApi.assets `
| Where-Object {$_.name -match "MinGit-[\d.]*?-64-bit.zip"} `
| Select-Object browser_download_url