Skip to content

Instantly share code, notes, and snippets.

View guest271314's full-sized avatar
💭
Fix WontFix

guest271314

💭
Fix WontFix
View GitHub Profile
@guest271314
guest271314 / dynamic_import_always_throws.js
Created January 3, 2024 05:26
Deno dynamic import("./exports") throws module not found for "exports.js" dynamically created in the script
// Deno dynamic import("./exports") throws module not found for "exports.js" dynamically created in the script
// dynamic_import_always_throws.js
// References: https://www.reddit.com/r/Deno/comments/18unb03/comment/kfsszsw/ https://github.com/denoland/deno/issues/20945
// Usage:
// deno run -A dynamic_import_always_throws.js
// bun run dynamic_import_always_throws.js
// node --experimental-default-type=module dynamic_import_always_throws.js
import { open, unlink } from "node:fs/promises";
const runtime = navigator.userAgent;
const encoder = new TextEncoder();
@guest271314
guest271314 / reddits_search_is_horrible.md
Created January 2, 2024 01:16
Reddit's site search is horrible. Some programmer kindly help them out...

So, somebody posted a question or r/javascript. In that question they used the term "Spread and Rest Operators". Now, ECMA-262 does not define spread syntax or rest element as operators. Nonetheless people have repeated that term over and over again.

At one point I asked the question about who came up with the terms "spread operator" on r/javascript.

Should be easy enough to search for and get the results I'm looking for using Reddit's search implementation... It ain't though. I tried on r/javascript using "spread operator" and author:guest271314; I tried on the site search as a whole. I tried for 10 minutes to find that post, my post, using Reddit's search implementation.

I wound up going through the pseudo-infinite scroll of my posts to locate the question I asked to ultimately find the comment where I posted the earliest usage of the term "spread operator" I could find online https://www.reddit.com/r/javascript/comments/xhhqsz/comment/iozf2ij/

@guest271314
guest271314 / README.md
Created December 31, 2023 13:18
Install repositories from GitHub to node_modules for Deno

Deno doesn't have a way to install repositories from GitHub to the local node_modules folder.

@guest271314
guest271314 / browser_nodejs_stdio.md
Created December 25, 2023 14:55
Let's create STDIO between the browser and Node.js using files

Node.js has watch and watchFile in fs module.

Chromium-based browsers (Chrome, Opera, Edge) have WICG File System Access implemented.

Let's create STDIO between the browser and Node.js using files.

Even though Node.js documentation recommends using watch(), we'll use watchFile() for this case. Just to see what happens. Hear the spin when interval is set to 5 so we get input of lowercase letters and output of lowercase letters transformed to uppercase letters in order.

The Node.js part.

@guest271314
guest271314 / ai_is_eurocentric.md
Created December 16, 2023 15:29
"AI" is Eurocentric

As a primary source researcher and programmer I am highly skeptical of "AI".

My personal opinion is the term "Artificial Intelligence", coined by John McCarthy (History of Artificial Intelligence) makes no sense on its face, as intelligence cannot be artificial. If intelligence is artificial it can't be real intelligence, it's artificial.

On OpenAI's Introducing ChatGPT page there is a section that reads

User: Tell me about when Christopher Columbus came to the US in 2015

ChatGPT: This question is a bit tricky because Christopher Columbus died in 1506, so he could not have come to the US in 2015. But let’s pretend for a moment that he did!

@guest271314
guest271314 / javascript_engines_and_runtimes.md
Last active April 15, 2024 02:03
A list of JavaScript engines, runtimes, interpreters

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine, used in Firefox, Servo and various other projects. It is written in C++, Rust and JavaScript. You can embed it into C++ and Rust projects, and it can be run as a stand-alone shell. It can also be [compiled](https://bytecodealliance.org/articles/making-javascript-run-fast-on

@guest271314
guest271314 / runtime.js
Last active December 10, 2023 14:33
Return the name of the JavaScript runtime the script is running in
const runtime = () => {
// TODO: More direct and exclusionary way to do this for QuickJS
if (
!globalThis.hasOwnProperty("hasOwn") &&
Array.isArray(globalThis.scriptArgs)
) {
return "qjs";
}
if (Object.hasOwn(globalThis, "tjs")) {
return globalThis.tjs.args[0];
@guest271314
guest271314 / webpack_errors.md
Created December 8, 2023 01:15
webpack errors
/webbundle/node_modules/.bin/webpack bundle ./webpack.wbn.js --mode=none
asset main.js 8.87 MiB [compared for emit] (name: main)
1065 modules

WARNING in ./node_modules/@swc/core/binding.js 16:28-61
Module not found: Error: Can't resolve 'child_process' in '/home/user/webbundle/node_modules/@swc/core'
 @ ./node_modules/@swc/core/index.js 62:88-108
 @ ./node_modules/terser-webpack-plugin/dist/utils.js 487:14-34
 @ ./node_modules/terser-webpack-plugin/dist/index.js 14:4-22
@guest271314
guest271314 / no-npm.md
Created November 28, 2023 02:00
Install Nodes.js packages and run Node.js scripts without npm or node - with Bun

I've been testing and experimenting over the past week or so with installing Node.js-specific packages - without using npm because somebody claimed Can this be used to create/download npm as a standalone executable? #3237

npm can’t be eliminated from the equation when you’re dealing with JavaScript ¯_(ツ)_/¯

Well, let's see about that...

First I had to get all of the dependencies from package.json and/or package-lock.json file. Turns out different packages can depend on different versions of the same named module. Ever hear about "callback hell"? Well, Node.js module dependency system can be dependency hell.

Fortunately for me, due to personal reasons I am evil now (TM) (Rebel Circus). So I fit right in in hell, hell I thrive in chaos.

@guest271314
guest271314 / a_modest_proposal_for_imperfect_software.md
Created November 24, 2023 00:37
A modest proposal for imperfect software

If you maintain software, it's perfect. Guaranteed. Copyrighted. Patented. Your compilers and frameworks and libraries have been downloaded billions of times.

If I asked some wild question about your software it's just that I might have some trivial use case that is not intended to make money, or some use case that is explicitly outside of your specification, or implementation. It's me. Your software is perfect, always will be. How dare me to use your perfect software in an imperfect manner outside of your clear and unambiguous mandates in your README. Where are my manners?