Skip to content

Instantly share code, notes, and snippets.

View afkvido's full-sized avatar
:electron:
rush

gemsvidø afkvido

:electron:
rush
View GitHub Profile
@afkvido
afkvido / dirname.ts
Last active February 28, 2023 21:14
EMCAscript fill for CommonJS __dirname.
import path from "path";
import { fileURLToPath } from "url";
const dirname : string = path.resolve(fileURLToPath(import.meta.url), "../..");
export default dirname;
@afkvido
afkvido / loadSwal.js
Last active February 28, 2023 21:13
Load SweetAlert2 Neutral into the current webpage.
(async()=>{if(window.Swal){return}eval(await(await fetch("https://cdn.jsdelivr.net/npm/sweetalert2-neutral@latest/dist/sweetalert2.all.min.js")).text())})();
@afkvido
afkvido / polyfill.js
Created March 1, 2023 23:17
Ensures that the webpage has all JavaScript standard library features, and loads them if it doesn't. (using core-js)
(async()=>{eval(await(await fetch("https://cdn.jsdelivr.net/npm/core-js-bundle/minified.min.js")).text())})();
@afkvido
afkvido / global.js
Created May 15, 2023 21:24
window.global polyfill
globalThis.global=globalThis;