Skip to content

Instantly share code, notes, and snippets.

View dclstn's full-sized avatar

Donnie dclstn

  • Scotland
View GitHub Profile
@dclstn
dclstn / betterttv-regex-keywords.md
Created June 19, 2026 12:35
BetterTTV — Using regular expressions in Highlight & Blacklist Keywords

Using Regular Expressions in BetterTTV Keywords

BetterTTV's Highlight Keywords and Blacklist Keywords support full regular expressions, in addition to plain words and phrases. This lets you match flexible patterns instead of a single fixed word.

Syntax

Wrap your pattern in ~/ and /, with optional flags after the closing slash:

@dclstn
dclstn / nightbot-phasmophobia-guessing-game.md
Last active October 31, 2026 01:10
Nightbot Phasmophobia Guessing Game

A server-less Nightbot command that utlizes a Cloudflare Worker to run a small prediction game for Phasmophobia where users can guess the ghost archetype.

Adding to chat:

!commands add !guess  👻 $(urlfetch https://nightbot-phasmophobia-guessing-game.vasp.dev?message=$(querystring))

How to use:

@dclstn
dclstn / wordle-painter.py
Last active July 20, 2025 12:05
A script to paint a 5x5 grid on Worlde
import argparse
parser = argparse.ArgumentParser(description="Wordle Painter")
parser.add_argument("--word", type=str, help="Today's wordle word")
# 0 = No match
# 1 = Match in the word but not in the right position
# 2 = Match in the word and in the right position
map = [
@dclstn
dclstn / animated-number.md
Created May 9, 2025 19:01
Framer Motion Animated Number Counter

Just a really simple animated number made in framer-motion, inspired by https://motion.dev/docs/react-animate-number

AnimatedNumber.tsx

import {motion} from 'framer-motion';
import classes from './AnimatedText.module.scss';
import classNames from 'classnames';

function AnimatedNumber({
  value,
@dclstn
dclstn / twitch-revert-layout.md
Last active January 3, 2025 19:18
Revert new twitch-layout script
  1. Navigate to www.twitch.tv
  2. Open the console "Cmd + Option + J" (on a Mac) or "Ctrl + Shift + J" (on Windows)
  3. Copy script below, and paste into console
  4. Enjoy the old layout
(async () => {
    await import('https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js');
    const experiments = Object.entries(__twilightSettings.experiments);
 const [experimentId] = experiments.find(([, {name}]) => name === 'web_channel_metadata_layout');
@dclstn
dclstn / dex.md
Last active September 15, 2024 08:44
Nighbot Pokédex Command - For looking up Pokémon and other Pokédex metrics

A server-less Nightbot command that utlizes a Cloudflare Worker to condense Pokédex API's API to be under 400 characters (Nighbot's urlfetch limit).

Adding to chat:

!commands !add !dex  📟 $(urlfetch https://pokedex.dclstn.workers.dev?pokemon=$(querystring))

How to use:

@dclstn
dclstn / useQueryState.ts
Last active December 11, 2024 15:59
A useful hook for managing query state
import React from 'react';
interface useQueryStateConfig<T> {
parse?: (value: string) => T;
serialize?: (value: T) => string;
defaultValue: T;
}
export default function useQueryState<T>(
key: string,
@dclstn
dclstn / ChakraAutocompleteInput.tsx
Created May 23, 2023 18:41
Implementation of an Autocomplete Input in Chakra UI
import {Box, Input, Text} from '@chakra-ui/react';
import React from 'react';
interface AutocompleteInputProps {
value: string;
matches: {label: string; value: string}[];
onChange: (value: string) => void;
}
export default function AutocompleteInput({
@dclstn
dclstn / useApi.ts
Created December 19, 2022 04:43
useApi React Hook
import React from "react";
interface Response<T> {
data: T | null;
isFetching: boolean;
error: string | null;
isSuccess: boolean;
}
export function useApi<T>(apiFunction: () => Promise<any>): [Response<T>, () => void] {