Skip to content

Instantly share code, notes, and snippets.

View randallb's full-sized avatar
🎬

Randall Bennett randallb

🎬
View GitHub Profile
@randallb
randallb / gist:43137dda045f1c4372ba9172e865b0f1
Created December 14, 2022 15:01
chatgpt helps me solve a stupid programming problem
i have an event handler on globalThis.addEventListener("keydown", func) how do i make it so it calls func by reference instead of by value
In JavaScript, functions are first-class objects, which means that they can be treated like any other object. This means that you can pass a reference to a function as an argument to another function.
To pass a function as a reference, you simply need to pass the name of the function without the () after it. For example:
Copy code
globalThis.addEventListener("keydown", func);
In this case, the addEventListener method will call the func function whenever the keydown event is triggered. The func function will be called by reference, which means that any changes made to the function within the event listener will be reflected in the original func function.
@randallb
randallb / esbuild_in_deno.ts
Last active November 27, 2022 04:28
I wrote a thing that should be executable in deno...
// this should be executable in deno.
// `deno run --allow-read --allow-write --allow-run --allow-net --allow-env packages/app/esbuild.ts`
import * as esbuild from "https://deno.land/x/[email protected]/mod.js";
const ts = `
import * as log from "https://deno.land/[email protected]/log/mod.ts";
import App from "/packages/app/Test.tsx";
console.log('wow');
log.info('such wow');
[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIBzc2gONdZbuCfJPnOz28c/C+OWNHFD2oXAEXaw3y3H1AAAABHNzaDo= ssh:
#!/usr/bin/env deno run -q --no-check --cached-only
import SchemaBuilder from "https://esm.sh/@pothos/[email protected]";
import { graphql } from "https://esm.sh/[email protected]/";
const builder = new SchemaBuilder({});
type Meters = number;
type GiraffeShape = {
[1] randallb@randallb-mbp> RUST_BACKTRACE=1 deno run bin/get_file.ts ~/rbcode
Check file:///Users/randallb/rbcode/bin/get_file.ts
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.
#!/usr/bin/env zsh
FILE=/tmp/continue_init.sh
NIX_INSTALLER=install_nix.sh
if [ -f "$FILE" ]; then
echo "$FILE exists... so we'll continue from where we left off."
rm $FILE
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// This is a specialised implementation of a System module loader.
"use strict";
// @ts-nocheck
/* eslint-disable */
let System, __instantiate;
(() => {
{"option_id": "1929378277129389_1929394570461093", "user_id": "2148457595194358"}

Money Is Not Wealth

If you want to create wealth, it will help to understand what it is. Wealth is not the same thing as money. [3] Wealth is as old as human history. Far older, in fact; ants have wealth. Money is a comparatively recent invention.

Wealth is the fundamental thing. Wealth is stuff we want: food, clothes, houses, cars, gadgets, travel to interesting places, and so on. You can have wealth without having money. If you had a magic machine that could on command make you a car or cook you dinner or do your laundry, or do anything else you wanted, you wouldn't need money. Whereas if you were in the middle of Antarctica, where there is nothing to buy, it wouldn't matter how much money you had.

Wealth is what you want, not money. But if wealth is the important thing, why does everyone talk about making money? It is a kind of shorthand: money is a way of moving wealth, and in practice they are usually interchangeable. But they are not the same thing, and unless you plan to get rich by counterfeiting,

Sam McMurray,Ron Taylor,Albert Brooks,Albert Brooks,Sam McMurray,Kelsey Grammer,June Foray,Penny Marshall,Paul Willson,Harvey Fierstein,James Earl Jones,Tony Bennett,Daryl Coley,Ken Levine,Tom Poston,Greg Berg,Alex Rocco,Phil Hartman,Larry King,Joey Miyashima,Sab Shimono,George Takei,Diana Tanaka,Jon Lovitz,Phil Hartman,Danny DeVito,Tracey Ullman,Frank Welker,Phil Hartman,Audrey Meadows,Jon Lovitz,Ringo Starr,Dustin Hoffman,Cloris Leachman,Daniel Stern,Michael Jackson,Kipp Lennon,Lona Williams,Neil Patrick Harris,Phil Hartman,Joe Mantegna,Chick Hearn,Magic Johnson,Jon Lovitz,Jackie Mason,Frank Welker,Phil Hartman,Larry McKay,Phil Hartman,Phil Hartman,Sting,Phil Hartman,Phil Hartman,Wade Boggs,Jose Canseco,Roger Clemens,Terry Cashman,Ken Griffey, Jr.,Don Mattingly,Steve Sax,Mike Scioscia,Ozzie Smith,Darryl Strawberry,Steve Allen,Frank Welker,Beverly D\Angelo,Kelsey Grammer,Christopher Guest,Michael McKean,Phil Hartman,Kimmy Robertson,Danny DeVito,Joe Frazier,Phil Hartman,Jon Lovitz,Bob Hope,Lona Williams,Phil