Skip to content

Instantly share code, notes, and snippets.

View AlcaDesign's full-sized avatar
💜
Doing something

Jacob Foster AlcaDesign

💜
Doing something
View GitHub Profile
@AlcaDesign
AlcaDesign / index.js
Last active December 5, 2022 00:11 — forked from LordSmurf/index.js
AOC Day 2 Part 1
const fs = require("fs/promises");
const fileName = "input.txt";
async function readInput(fileName) {
const file = await fs.readFile(fileName, "utf-8");
return file.trim().replace(/\r/g, "").split("\n");
}
async function solveFirst(fileName) {
const inputs = await readInput(fileName);
@AlcaDesign
AlcaDesign / tmi.js-parse-emotes-cheermotes.js
Created June 16, 2025 08:48
Parse Twitch emotes and cheermotes for (old) tmi.js
const prefixes = [
'Cheer', 'DoodleCheer', 'cheerwhal', 'Corgo', 'Scoops', 'uni', 'ShowLove', 'Party', 'SeemsGood', 'Pride',
'Kappa', 'FrankerZ', 'HeyGuys', 'DansGame', 'TriHard', 'Kreygasm', '4Head', 'SwiftRage', 'NotLikeThis',
'FailFish', 'VoHiYo', 'PJSalt', 'MrDestructoid', 'bday', 'RIPCheer', 'Shamrock', 'BitBoss', 'Streamlabs',
'Muxy', 'HolidayCheer', 'Goal', 'Anon', 'Charity'
];
const cheermoteRegex = new RegExp(`\\b(${prefixes.join('|')})(\\d+)\\b`, 'ig');
function onMessage(channel, tags, messageText, self) {
// Spread syntax or Array.from to preserve unicode surrogate pairs (emojis) to match Twitch's behavior