Skip to content

Instantly share code, notes, and snippets.

@NextDev65
NextDev65 / encodeToHtmlHex.js
Created March 9, 2024 07:56
Converts a string to HTML hexadecimals
function encodeToHtmlHex(inputString) {
return Array.from(inputString, char => '&#x' + char.charCodeAt(0).toString(16) + ';').join('');
}
// Example usage
//encodeToHtmlHex("Hello world!");
// => 'Hello world!'
// More readable version
/*
setInterval(function(){
let topRow = document.getElementsByClassName('assistant-created')[0];
let tripleDotMenu = getElementsByTagName('button')[0];
tripleDotMenu.click();
let menuItems = document.getElementsByClassName('menu-root')[0].children;
// delete (last menu item)
menuItems[menuItems.length - 1].click();
// confirm deletion
document.getElementsByClassName('btn btn-sm btn-filled btn-negative')[0].click();
}, 1000);
  • Replace OWNERNAME and REPONAME with the Owner's username and Repository name respectively
  • Change "browser_download_url.*zip" to the appropriate regex match pattern

  • Use curl to get the JSON response for the latest release
  • Use findstr to find the line containing file URL
  • Use set and := to extract the URL
  • Use curl to download it (alternatives are OK, but curl is built-in)

Single file

gethub.bat

@NextDev65
NextDev65 / hover_fade.js
Last active April 11, 2025 23:12
fade unless hovered over
function hover_fade(elements) {
if (!elements) { elements = document.getElementsByTagName('img'); }
if (!elements.length) { elements = [elements]; }
for (const item of elements) {
item.style.opacity = 0.05;
item.onmouseover = () => { item.style.opacity = 1.0 };
item.onmouseout = () => { item.style.opacity = 0.05 };
}
}
@NextDev65
NextDev65 / img_fade.js
Last active July 9, 2021 02:12
Image Faded Until Hover
const images = document.getElementsByTagName('img');
for(const image of images) {
image.style.opacity = .05;
image.onmouseover = function(){this.style.opacity = 1.0};
image.onmouseout = function(){this.style.opacity = 0.05};
}
@NextDev65
NextDev65 / img_invert.js
Last active July 9, 2021 02:11
Image Invert
let images = document.getElementsByTagName("img");
for (const image of images) {
image.style.getPropertyValue("filter") == "" ? image.style.setProperty("filter","invert(1)","important") : image.style.removeProperty("filter");
}