Skip to content

Instantly share code, notes, and snippets.

View Davis-3450's full-sized avatar
🐱
meow

Davis Davis-3450

🐱
meow
View GitHub Profile
@Davis-3450
Davis-3450 / spintax.js
Created December 24, 2024 07:01
A JS implementation of nested spintax
function processSpintax(text) {
// Define the regex that captures the innermost { ... }
const regex = /\{([^{}]+)\}/;
// Keep going while the text still matches { ... }
while (regex.test(text)) {
text = text.replace(regex, (match, contents) => {
// Split the contents by "|"
const parts = contents.split('|');
@Davis-3450
Davis-3450 / captionScraper.js
Created November 14, 2024 01:04
twitter caption scraper (js console)
// Run this in the browser console on any profile's timeline page
(async function() {
// Set to store unique tweets
let tweetsSet = new Set();
let scrollAttempts = 0;
const maxScrollAttempts = 5; // Number of times to try scrolling without new tweets before stopping
// Function to sleep for a given time (in milliseconds)
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));