Skip to content

Instantly share code, notes, and snippets.

// http://davidwalsh.name/essential-javascript-functions
/*
debounce
The debounce function can be a game-changer when it comes to event-fueled performance.
If you aren't using a debouncing function with a scroll, resize, key* event, you're
probably doing it wrong. Here's a debounce function to keep your code efficient:
*/
@JenieX
JenieX / getURLParamValue.js
Created July 31, 2025 10:20 — forked from pbakondy/getURLParamValue.js
Return document URL GET parameter value by name
function getURLParamValue(name) {
var v;
document.location.search.substring(1).split('&').forEach(function(value) {
if (value.split('=')[0] === name) {
v = value.split('=')[1];
}
});
return v;
}
@JenieX
JenieX / parseUrl.js
Created July 31, 2025 10:18 — forked from pbakondy/parseUrl.js
Parse URL
// Parse URL
// References:
// http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
// https://github.com/angular/angular.js/blob/c94329a891a1c082567c490ccf58ba8592b464ad/src/ng/urlUtils.js
(function() {
window.parseUrl = function(url) {
var href = url,
a = document.createElement('a');
if (document.documentMode) {
a.setAttribute('href', href);
@JenieX
JenieX / parse-json.js
Created July 31, 2025 10:11 — forked from pbakondy/parse-json.js
Parse JSON, strip BOM
// https://github.com/npm/npm/blob/master/lib/utils/parse-json.js
'use strict'
var parseJSON = module.exports = function (content) {
return JSON.parse(stripBOM(content))
}
parseJSON.noExceptions = function (content) {
try {
@JenieX
JenieX / ChromeRemoteDebugger.bat
Created June 23, 2025 23:51 — forked from FreaKzero/ChromeRemoteDebugger.bat
Windows - Remote Chrome debugging over Network (Start as Admin)
@echo off
netsh interface portproxy delete v4tov4 listenport=9222 listenaddress=0.0.0.0
start /b cmd /c call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=dev-mode-removeme --disk-cache-dir=null --overscroll-history-navigation=0 --disable-web-security -–allow-file-access-from-files "%~dp0/src/index.html"
timeout 5
netsh interface portproxy add v4tov4 listenport=9222 connectaddress=127.0.0.1 connectport=9222 listenaddress=0.0.0.0
cls
echo ============================================
echo Chrome started with following configuration:
echo ============================================
echo * No-Caching
@JenieX
JenieX / esm-package.md
Created June 17, 2025 04:41 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@JenieX
JenieX / redirect-to-farside.js
Created June 17, 2025 03:33 — forked from examosa/fetch-instances.js
Redirect to Farside (Userscript)
// ==UserScript==
// @name Redirect to Farside
// @version 1.4
// @description Redirects the configured websites to third-party privacy-respecting front ends.
// @author examosa
// @license AGPLv3-or-later
// @updateUrl https://gist.github.com/examosa/50eb28bc16a006b62b3f43893ab457e7/raw/redirect-to-farside.js
// @match https://www.fandom.com/*
// @match https://*.medium.com/*
// @match https://stackoverflow.com/*
@JenieX
JenieX / useStorage.tsx
Created November 12, 2023 01:38 — forked from JohnBra/useStorage.tsx
Typed React useStorage hook for chrome extensions
import { Dispatch, SetStateAction, useState, useEffect, useCallback, useRef } from 'react';
export type StorageArea = 'sync' | 'local';
// custom hook to set chrome local/sync storage
// should also set a listener on this specific key
type SetValue<T> = Dispatch<SetStateAction<T>>;
/**
@JenieX
JenieX / letterboxd-clear-watched-films.js
Created September 17, 2023 10:48
Letterboxd - clear films in current page from watched list
/** @param {number} milliSeconds */
async function sleep(milliSeconds) {
return new Promise((resolve) => {
setTimeout(resolve, milliSeconds);
});
}
const elements = /** @type {HTMLSpanElement[]} */ ([
...document.querySelectorAll('span[data-action$="/mark-as-not-watched/"]'),
]);
@JenieX
JenieX / safeguard.user.js
Created August 22, 2023 02:47
Userscript: Safeguard — Unbreak the web by preventing sites from blocking default browser behavior such as copy-paste, context menus, text selection, etc.
// ==UserScript==
// @name Safeguard
// @description Unbreak the web by preventing sites from blocking default browser behavior such as copy-paste, context menus, text selection, etc.
// @match <all_urls>
// @run-at document-start
// @version 2023.08.21.1
// @downloadURL https://gist.github.com/msanders/76923c70348086108ca47e7b46ffc97c/raw/safeguard.user.js
// @updateURL https://gist.github.com/msanders/76923c70348086108ca47e7b46ffc97c/raw/safeguard.user.js
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABMCAMAAADwSaEZAAAARVBMVEVHcEzZOy8AAAAAAADfTz4AAAAAAAAAAAAAAAABAQElFxY0NDNwcG+mpaRSUlLPzs27urnqWkeSkpGuLCRxIhvSLyfDSzsFvPdkAAAACXRSTlMA+eU8+8J0G6R5tfGAAAACbElEQVR4Xu2X25bqMAxD6b1yrr3A/3/qwfFAVsmcJpm+okcoG0l2utrbmb766qupG8dxHp/qpkuccWhxUDuM3Z9Is4BAygYpggDnWl43MEdp412U80arwBtrXDFKrf7NWNdINZZxxe5GADaQvJZwIlL651MAcxlrBhSjvCUkop+vgKHQl2ZUaIf2R98vS3N/atv2QCfGrWXehKWZ9OgX0f2tjXlWaPneBtCTpRi1vMTOogjhEp0POgHeOQvsgonWojZAOeeBKbdgQLhuY8QJbXUO6EpgCrR8qD/QdraWdzYxDOC+Tq0R27/9EXZPYAZtwWYYl1bWpLC1YG0HaKewJ40lnem