Skip to content

Instantly share code, notes, and snippets.

View randallb's full-sized avatar

Randall Bennett randallb

View GitHub Profile
View my public key for randallbrain AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBPgexLcJ7muB+z2GUqwMbrOpk4oHyMg4bM3GY4IGj1nSGRv9oGNV8r58h+4Slx3r6DWXa7tlPh5aN81jHgO2g2cAAAAac3NoOnJhbmRhbGxicmFpbmJ1aWx0aW5rZXk= randallb@Randalls-MacBook-Pro.local
randallb /
Created March 24, 2023 18:27
I didn't write any of this code.

Holy shit.

GPT4 wrote all of this code. I can't believe it. I can build products literally in a single day now.

randallb / gist:43137dda045f1c4372ba9172e865b0f1
Created December 14, 2022 15:01
chatgpt helps me solve a stupid programming problem
View gist:43137dda045f1c4372ba9172e865b0f1
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 / esbuild_in_deno.ts
Last active November 27, 2022 04:28
I wrote a thing that should be executable in deno...
View esbuild_in_deno.ts
// 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 "";
const ts = `
import * as log from "";
import App from "/packages/app/Test.tsx";
console.log('wow');'such wow');
View pubkey AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIBzc2gONdZbuCfJPnOz28c/C+OWNHFD2oXAEXaw3y3H1AAAABHNzaDo= ssh:
View deno_graphql.ts
#!/usr/bin/env deno run -q --no-check --cached-only
import SchemaBuilder from "";
import { graphql } from "";
const builder = new SchemaBuilder({});
type Meters = number;
type GiraffeShape = {
View deno panic
[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
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
if [ -f "$FILE" ]; then
echo "$FILE exists... so we'll continue from where we left off."
rm $FILE
View bundle.js
// 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;
(() => {
View gist:f44941974671165e638d9ab905644772
{"option_id": "1929378277129389_1929394570461093", "user_id": "2148457595194358"}