Skip to content

Instantly share code, notes, and snippets.

const writeJoke = async (joke, path) => {
const filehandle = await fs.open(path, 'w');
try {
return await filehandle.write(joke);
} finally {
await filehandle.close();
}
};
(async () => {
const [j1, j2] = await gfunction();
// ==UserScript==
// @name Stack Experiment Off
// @author CertainPerformance
// @description Turns off the voting experiment - shows true vote totals on pageload and after voting
// @description https://meta.stackoverflow.com/questions/390178/new-popup-message-when-voting-on-a-question
// @version 1.1.1
// @include /^https://stackoverflow\.com/questions/(?:\d+|tagged|search)/
// @run-at document-start
// @grant none
// ==/UserScript==
// For reference:
// https://stackoverflow.com/questions/54776759/how-to-avoid-accidentally-implicitly-referring-to-properties-on-the-global-objec
const fakeWindow = (() => {
// Declare Object and ReferenceError as variable names in this scope
// since implicit references to them on window will eventually fail during the below loop
const { Object, ReferenceError } = window;
const fakeWindow = Object.create(Object.getPrototypeOf(window));
const descriptors = Object.getOwnPropertyNames(window)
.reduce((a, propName) => {