Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Nilstrieb/0c6ce9d5a44df64620bb7189cc8cc43c to your computer and use it in GitHub Desktop.
Save Nilstrieb/0c6ce9d5a44df64620bb7189cc8cc43c to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Code 55% faster with GitHub Copilot!
// @description Code 55% faster with GitHub Copilot!
// @version 55.6
// @downloadURL https://gist.github.com/Nilstrieb/0c6ce9d5a44df64620bb7189cc8cc43c/raw/9588f92c93302b54d2aabdce4bc8a37118bb0c7a/Code%252055%2525%2520faster%2520with%2520GitHub%2520Copilot!.user.js
// @updateURL https://gist.github.com/Nilstrieb/0c6ce9d5a44df64620bb7189cc8cc43c/raw/9588f92c93302b54d2aabdce4bc8a37118bb0c7a/Code%252055%2525%2520faster%2520with%2520GitHub%2520Copilot!.user.js
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
// Based on https://gist.github.com/Nemo157/a4df65856b79d50f184974a475c7ce98/raw/Code%252055%2525%2520faster%2520with%2520GitHub%2520Copilot!.user.js
(function() {
'use strict'
const s = "Code 55% faster with GitHub Copilot!"
const s2 = "Copilot!"
const replace = () => {
const els = []
for (const el of document.all) {
if (el.childElementCount !== 0 || !("innerText" in el)) continue;
const { innerText } = el;
if (innerText == s || innerText == s2) continue;
const len = innerText.trim().length;
if (len == 0) continue;
if (len > (s.length - 20) && len < (s.length + 20)) {
els.push([el, s])
} else if (len < 20) {
els.push([el, s2]);
}
}
let [el, replacement] = els[Math.floor(Math.random() * els.length)]
if (!el) return;
console.log(`replacing '${el.innerText}'`)
el.innerText = replacement
setTimeout(replace, 1000);
}
setTimeout(replace, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment