Avatar

neverstew

Twice called wise. 🧐 Building a better world at https://equalcare.coop.
Joined January 12, 2023
Public vals
92
realTimeDateDifferenceForm
neverstew
realTimeDateDifferenceForm
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
discordActivityClient
neverstew
discordActivityClient
// Once setupDiscordSdk is complete, we can assert that "auth" is initialized
Script
superchargedQueryParams
neverstew
superchargedQueryParams
⚡ Supercharge your query params Tired of the old x=y query param limitations? Ever wished you could say x>y or x!=y as well? Now you can! Parse query params with superchargedQueryParams and you get an array of operations for each parameter instead: import { superchargeQueryParams } from "https://esm.town/v/neverstew/superchargeQueryParams"; console.log(superchargeQueryParams(new URL("https://example.com?a=b&c>d&e!=f&e>=g"))) // {"a":[{"eq":"b"}],"c":[{"gt":"d"}],"e":[{"ne":"f"},{"gte":"g"}]}
Script
ivoryPorpoise
neverstew
ivoryPorpoise
@jsxImportSource https://esm.sh/preact
HTTP
setCorsHeaders
neverstew
setCorsHeaders
An interactive, runnable TypeScript val by neverstew
Script
discordEventReceiver
neverstew
discordEventReceiver
An interactive, runnable TypeScript val by neverstew
HTTP
vtApiExample
neverstew
vtApiExample
An interactive, runnable TypeScript val by neverstew
Script
vtApiTypes
neverstew
vtApiTypes
* This file was auto-generated by openapi-typescript. * Do not make direct changes to the file.
Script
updateVtApiTypes
neverstew
updateVtApiTypes
An interactive, runnable TypeScript val by neverstew
Cron
viewSource
neverstew
viewSource
View source code Just like a right click + inspect on desktop, except available on mobile too! Just write the website after the / e.g. https://neverstew-viewSource.web.val.run/bbc.co.uk
HTTP
prettifyHtml
neverstew
prettifyHtml
An interactive, runnable TypeScript val by neverstew
Script
sleep
neverstew
sleep
An interactive, runnable TypeScript val by neverstew
Script
inTheBackgroundExample
neverstew
inTheBackgroundExample
inTheBackground With the addition of the "early return" feature of web handlers, you can now process short background tasks in vals. This can be really useful for occasions where an immediate response is required, with a subsequent update a few seconds later e.g. a Discord bot that calls ChatGPT needs to respond within a few seconds, which can be too fast for the AI to generate a response. We can instead reply immediately and then update that message later, inTheBackground Simply wrap something in inTheBackground and it will do just that! In this example, we log something a few seconds later than the web response is sent back.
HTTP
inTheBackground
neverstew
inTheBackground
An interactive, runnable TypeScript val by neverstew
Script
earlyWebReturn
neverstew
earlyWebReturn
This val demonstrates the early response return feature of web vals. It produces two timestamps: one in the response JSON, which returns pretty much straight away one in the logs, three seconds after the response is returned
HTTP
html
neverstew
html
@jsxImportSource npm:preact
Script