Skip to content

Instantly share code, notes, and snippets.

View michaelnordmeyer's full-sized avatar

Michael Nordmeyer michaelnordmeyer

View GitHub Profile
@michaelnordmeyer
michaelnordmeyer / find-unused-css.js
Created March 8, 2023 12:21
Find unused CSS rules on a page
(function() {
for (var ssi = 0; ssi < document.styleSheets.length; ssi++) {
var rules = document.styleSheets[ssi].cssRules || [];
var sheetHref = document.styleSheets[ssi].href || 'inline';
for (var ri = 0; ri < rules.length; ri++) {
if (!document.querySelectorAll(rules[ri].selectorText).length) {
console.log(`${sheetHref}: "${rules[ri].selectorText}" not found.`);
}
}
}
@michaelnordmeyer
michaelnordmeyer / langoliers.rb
Created May 21, 2022 15:02 — forked from robinsloan/langoliers.rb
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@michaelnordmeyer
michaelnordmeyer / unfave.rb
Created May 21, 2022 15:02 — forked from robinsloan/unfave.rb
Unfave script, because why not??
#!/usr/bin/env ruby
require "rubygems"
require "twitter"
require "json"
require "faraday"
# things you must configure
TWITTER_USER = "your_username"
# get these from dev.twitter.com
@michaelnordmeyer
michaelnordmeyer / twitter-archive-search.html
Last active November 7, 2022 15:54
Find Tweet IDs in Twitter's Data Export. Has to be placed in the folder where the tweet.js is located.
<!DOCTYPE html>
<html>
<head>
<meta title="Find Tweet IDs in Twitter's Data Export">
<meta charset="UTF-8">
<style>
body {
font-family: sans-serif;
line-height: 1.5;
@michaelnordmeyer
michaelnordmeyer / twitter-unretweet.js
Last active August 21, 2023 07:45
Deletes all your Twitter retweets when being on your profile page twitter.com/<username> as of early 2022
// Deletes all your Twitter retweets when being on your profile page twitter.com/<username>
// Barebones script: runs every second, unretweets the topmost retweet, scrolls to the bottom if no more retweets on page
// It won't stop unless manually reloading the page removes this code. Tested with Twitter web May 2022
setInterval(
function() {
console.log('Searching for unretweet UI...');
var menu = document.querySelectorAll('[data-testid=unretweet]')[0]; // find unretweet menu
if (menu === undefined) {
console.log('No unretweet menus found. Scrolling to load more tweets...');
@michaelnordmeyer
michaelnordmeyer / twitter-unlike.js
Last active May 1, 2022 14:38
Deletes all your Twitter likes when being on your profile page twitter.com/<username>/likes as of early 2022
// Deletes all your Twitter likes when being on your profile page twitter.com/<username>/likes
// Barebones script: runs every second, unlikes the topmost like, scrolls to the bottom if no more likes on page
// It won't stop unless manually reloading the page removes this code. Tested with Twitter web May 2022
setInterval(
function() {
console.log('Searching for unlike UI...');
var button = document.querySelectorAll('[data-testid=unlike]')[0]; // find unlike menu
if (button === undefined) {
console.log('No unlike buttons found. Scrolling to load more tweets...');