I built this thing, it's kind of insane. In the worker, you can call it almost like any other async function... including type safety.
I don't really have time to explain more, but maybe i will later.
{ | |
inputs = { | |
flake-utils.url = "github:numtide/flake-utils"; | |
nixpkgs.url = "nixpkgs/nixos-24.11"; | |
nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; | |
}; | |
outputs = { self, nixpkgs, flake-utils, nixpkgs-unstable }: | |
flake-utils.lib.eachDefaultSystem (system: | |
let |
import type { Handler } from "packages/lib/types/Handler.ts"; | |
import { shutdownBackend } from "packages/events/mod.ts"; | |
// import { createLogger } from "packages/logs/mod.ts"; | |
import { APIGatewayEvent } from "packages/lib/types/aws.ts"; | |
function createLogger(..._args: Array<string>) { | |
return console.log; | |
} | |
const log = createLogger("lambda:runtime", "debug"); | |
const logInfo = createLogger("lambda:runtime", "info"); | |
const logError = createLogger("lambda:runtime", "error"); |
import { | |
Loader, | |
PluginBuild, | |
} from "https://deno.land/x/esbuild@v0.15.15/mod.js"; | |
import { dirname, join } from "https://deno.land/std@0.114.0/path/mod.ts"; | |
import { createLogger } from "packages/logs/mod.ts"; | |
const log = createLogger("esbuildDenoPlugin", "debug"); | |
const logError = createLogger("esbuildDenoPlugin", "error"); |
sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBPgexLcJ7muB+z2GUqwMbrOpk4oHyMg4bM3GY4IGj1nSGRv9oGNV8r58h+4Slx3r6DWXa7tlPh5aN81jHgO2g2cAAAAac3NoOnJhbmRhbGxicmFpbmJ1aWx0aW5rZXk= randallb@Randalls-MacBook-Pro.local |
Holy shit.
GPT4 wrote all of this code. I can't believe it. I can build products literally in a single day now.
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. |
// 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/esbuild@v0.15.15/mod.js"; | |
const ts = ` | |
import * as log from "https://deno.land/std@0.165.0/log/mod.ts"; | |
import App from "/packages/app/Test.tsx"; | |
console.log('wow'); | |
log.info('such wow'); |
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIBzc2gONdZbuCfJPnOz28c/C+OWNHFD2oXAEXaw3y3H1AAAABHNzaDo= ssh: |
#!/usr/bin/env deno run -q --no-check --cached-only | |
import SchemaBuilder from "https://esm.sh/@pothos/core@3.13.0"; | |
import { graphql } from "https://esm.sh/graphql@16.5.0/"; | |
const builder = new SchemaBuilder({}); | |
type Meters = number; | |
type GiraffeShape = { |