Public vals
113
maxm avatar
maxm
extractProjectValInfo
Script
Like https://www.val.town/v/pomdtr/extractValInfo, but for projects. (Should probably be contributed back to pomdtr's)
0
maxm avatar
maxm
emojiTodoListApp
HTTP
@jsxImportSource https://esm.sh/react
0
maxm avatar
maxm
appealingApricotCattle
Script
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
importProjectFile
Script
Simple wrapper to download project static files. import { importProjectFile } from "https://esm.town/v/maxm/importProjectFile"; const styleCss = await importProjectFile(import.meta.url, "../public/style.css")
1
maxm avatar
maxm
lockfileImportMap
Script
Lockfile Import Map Use an import map to make sure your Val frontend and backend are always using the exact same versions. We already track the versions of your https imports in the Deno lockfile. Now you can expose those on the frontend as well using an import map. Use it like so: import { lockfileImportMap } from "https://esm.town/v/maxm/lockfileImportMap" return new Response(` <script type="importmap">${lockfileImportMap()}</script> <script type="module" src="${import.meta.url}"></script> `, { headers: {"content-type": "text/html"}}); Here's an example app I made with townie: https://www.val.town/v/maxm/emojiTodoListApp You can see that the "https://esm.sh/react" import imports the version directly without any redirects. Saving on network hops and also ensuring version stability!
0
maxm avatar
maxm
tastefulIvoryWorm
Script
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
isESMshChanging
HTTP
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
trackESMContent
Cron
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
exaltedAmberKiwi
HTTP
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
hnhiringStats
Script
Scrapes hnhiring.com for the total count of job postings in every Who's Hiring post on Hacker News: 194 jobs, january 2025 337 jobs, december 2024 325 jobs, november 2024 342 jobs, october 2024 311 jobs, september 2024 328 jobs, august 2024 384 jobs, july 2024 351 jobs, june 2024 418 jobs, may 2024 306 jobs, april 2024 313 jobs, march 2024 356 jobs, february 2024 294 jobs, january 2024 337 jobs, december 2023 388 jobs, november 2023 353 jobs, october 2023 318 jobs, september 2023 367 jobs, august 2023 342 jobs, july 2023 358 jobs, june 2023 423 jobs, may 2023 380 jobs, april 2023 434 jobs, march 2023 465 jobs, february 2023 386 jobs, january 2023 505 jobs, december 2022 544 jobs, november 2022 481 jobs, october 2022 529 jobs, september 2022 664 jobs, august 2022 556 jobs, july 2022 753 jobs, june 2022 792 jobs, may 2022 771 jobs, april 2022 829 jobs, march 2022 841 jobs, february 2022 686 jobs, january 2022 788 jobs, december 2021 993 jobs, november 2021 816 jobs, october 2021 958 jobs, september 2021 882 jobs, august 2021 921 jobs, july 2021 1022 jobs, june 2021 888 jobs, may 2021 918 jobs, april 2021 945 jobs, march 2021 979 jobs, february 2021
0
maxm avatar
maxm
emojiVectorEmbeddings
Script
// Initialize OpenAI client
0
maxm avatar
maxm
visibleYellowPike
Script
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
discordSignatureVerifyExample
HTTP
// Your public key can be found on your application in the Developer Portal
1
maxm avatar
maxm
wideLib
Script
// const rows = parseRows([
0
maxm avatar
maxm
wide
HTTP
WIDE Store any unstructured JSON data. Retrieve it with an expressive and efficient query system. WIDE is a library and service hosted on Val Town. Authenticate and use it with your Val Town credentials, or fork it and connect it to your own Clickhouse Instance. import { ValSession } from 'https://esm.town/v/maxm/valSession'; import { Wide } from 'https://esm.town/v/maxm/wide'; // Use your Val Town API Token to create a session const wide = new Wide(await ValSession.new(Deno.env.get("valtown"))) // Write any data. await wide.write([ { user: {id: 1, name: 'Alice', email: 'alice@example.com' }}, { user: {id: 2, name: 'Bob', email: 'bob@example.com' }}, { user: {id: 3, name: 'Charlie', email: 'charlie@example.com' }}, ]); await wide.fields("user.") // => [ // { fieldName: "user.email", fieldType: "string", count: 3 }, // { fieldName: "user.id", fieldType: "number", count: 3 }, // { fieldName: "user.name", fieldType: "string", count: 3 } // ] await wide.values("user.email") // [ // { value: "bob@example.com", count: 1 }, // { value: "charlie@example.com", count: 1 }, // { value: "alice@example.com", count: 1 } // ] await wide.search({ start: new Date(Date.now() - 1000 * 60 * 10), end: new Date(), filters: [{ fieldName: "user.name", operator: "equals", value: "Alice" }], }) // [{ user: { name: "Alice", email: "alice@example.com", id: 1 } }];
4
maxm avatar
maxm
valSession
HTTP
Val Session import { ValSession } from "https://esm.town/v/maxm/valSession"; // Generate a token from your valtown api key. const token = await ValSession.newSession(Deno.env.get("valtown")); // Other services can use it to authenticate const user = await ValSession.validate(token); Fork it, provide your own VT_SESSION_PRIVATE_KEY, and update the hardcoded public key. You can generate your own keys like so: import { crypto } from "https://deno.land/std@0.198.0/crypto/mod.ts"; // Generate a key pair for JWT signing and verification const { privateKey, publicKey } = await crypto.subtle.generateKey( { name: "RSASSA-PKCS1-v1_5", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256", }, true, ["sign", "verify"], ); function formatPEM(b64: string, type: "PRIVATE KEY" | "PUBLIC KEY"): string { const lines = b64.match(/.{1,64}/g) || []; return `-----BEGIN ${type}-----\n${lines.join("\n")}\n-----END ${type}-----`; } const privateKeyPem = formatPEM( btoa(String.fromCharCode(...new Uint8Array(exportPrivateKey))), "PRIVATE KEY", ); const publicKeyPem = formatPEM( btoa(String.fromCharCode(...new Uint8Array(exportPublicKey))), "PUBLIC KEY", ); console.log(privateKeyPem, publicKeyPem);
3