This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Github no-SPA | |
// @version 1.0 | |
// @description Disables client-side navigation (turbolinks) on GitHub. | |
// @match https://github.com/* | |
// @run-at document-end | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createWorker(fn) { | |
const url = URL.createObjectURL( | |
new Blob([`\ | |
onmessage = ({ data }) => { | |
const fn = ${fn.toString()}; | |
const result = fn(...JSON.parse(data)); | |
self.postMessage(result); | |
}; | |
`]) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function importCss(url) { | |
try { | |
return await (new Function(`return import("${url}", { with: { type: "css" } })`))(); | |
} catch { | |
try { | |
return await (new Function(`return import("${url}", { assert: { type: "css" } })`))(); | |
} catch { | |
return fetch(url).then(res => res.text()).then(cssText => { | |
const stylesheet = new CSSStyleSheet(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { promisify } from 'node:util'; | |
import { exec } from 'node:child_process'; | |
const $ = async (strings, ...values) => { | |
try { | |
return (await promisify(exec)(String.raw({ raw: strings }, ...values))).stdout; | |
} catch { | |
return ''; // yolo | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chars = [...'0123456789abcdefghijklmnopqrstuvwxyz']; | |
const charsMap = Object.fromEntries(chars.map((letter, i) => [letter, i])); | |
/** | |
* Function that encodes a string using mulberry32. | |
* @param what What do you want to encode? | |
* @param seed Pick a seed, any seed. | |
* @returns Encoded string. | |
*/ | |
export const encode = (what: string, seed: number) => { |