Skip to content

Instantly share code, notes, and snippets.

@iotashan
iotashan / github-delete-stale-branches.js
Last active May 16, 2025 00:52 — forked from chenrui333/github-delete-stale-branches.js
Delete stale branches from the GitHub repo's stale branches page (github.com/user/repo/branches/stale). Originally from https://stackoverflow.com/a/69089905
async function deleteStaleBranches(delay=75) {
var stale_branches = document.getElementsByClassName('prc-Button-ButtonBase-c50BI prc-Button-IconButton-szpyj');
for (var i = 0; i < stale_branches.length; i++) {
stale_branches.item(i).click();
await new Promise(r => setTimeout(r, delay));
}
const next = document.querySelector('[aria-label="Next Page"]');
if(next) {
next.click();
setTimeout(() => deleteStaleBranches(delay), delay);
function main(args) {
return new Promise( async (resolve, reject) => {
console.log('current max is '+totalChars);
var options = {
uri: 'https://www.comicvine.com/api/characters',
qs: {
api_key: key,
@iotashan
iotashan / gist:4128173
Created November 21, 2012 22:06 — forked from joshualambert/gist:4128161
Switch loop
followMeSwtichCheckbox.eventOverride = false;
followMeSwtichCheckbox.addEventListener('change', function(e) {
if (!followMeSwtichCheckbox.eventOverride) {
if (checkSOSactive() === false) {
alert('SOS inactive.');
} else {
followMeSwtichCheckbox.eventOverride = true;
followMeSwtichCheckbox.value = !followMeSwtichCheckbox.value;
}