Avatar

neverstew

Twice called wise. 🧐 Building a better world at https://equalcare.coop.
Joined January 12, 2023

Public vals
119

neverstew avatar
thisValUrl
@neverstew
Script
This Val URL Returns the URL of the val that calls this function. See https://www.val.town/v/neverstew.thisValUrlExample
neverstew avatar
viewSource
@neverstew
HTTP
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
neverstew avatar
generateQR
@neverstew
HTTP
Generate QR codes Generate a QR code for any link instantly! Example https://neverstew-generateQR.web.val.run?url=https://neverstew.com
neverstew avatar
scheduleEmail
@neverstew
Script
This val allows you to send me an email at a certain datetime. Fun!
neverstew avatar
blobDirList
@neverstew
Script
List things in a blob directory Blobs can be organised using "directories" e.g. /animals all-animals.txt /dogs sausage.txt /cats tom.txt is really only three files: /animals/all-animals.txt , /animals/dogs/sausage.txt and /animals/cats/tom.txt because directories don't really exist, we're just making longer filenames. When you want to list things only "in a directory" and none of the child "directories", you can use this val. import { blobDirList } from "https://esm.town/v/neverstew/blobDirList"; console.log(await blobDirList("/animals")); // returns only "/animals/all-animals.txt"
neverstew avatar
prettifyHtml
@neverstew
Script
An interactive, runnable TypeScript val by neverstew
neverstew avatar
sleep
@neverstew
Script
An interactive, runnable TypeScript val by neverstew
neverstew avatar
inTheBackgroundExample
@neverstew
HTTP
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.
neverstew avatar
sendPDF
@neverstew
Script
An interactive, runnable TypeScript val by neverstew
neverstew avatar
renderFormAndSaveData
@neverstew
HTTP
An interactive, runnable TypeScript val by neverstew
neverstew avatar
saveFormData
@neverstew
HTTP
An interactive, runnable TypeScript val by neverstew
neverstew avatar
manchesterBerylStationsGeojson
@neverstew
Script
An interactive, runnable TypeScript val by neverstew
neverstew avatar
ivoryPorpoise
@neverstew
HTTP
@jsxImportSource https://esm.sh/preact
neverstew avatar
cors_example
@neverstew
HTTP
CORS issues are the bane of frontend engineers. In Val Town, if you don't customize any CORS headers, we add these defaults: Access-Control-Allow-Origin: "*" Access-Control-Allow-Methods: "GET,HEAD,PUT,PATCH,POST,DELETE" You can override them if you wish to disallow CORS. Check out @neverstew/setCorsHeaders for the easiest way to do this in your code. This val is a client-side-rendered React app that makes requests to @stevekrouse/cors_example_backend. The backend is in a different val because CORS applies to requests on different domains. The backend has examples of the default permissive CORS behavior and disabled CORS.
neverstew avatar
setCorsHeaders
@neverstew
Script
An interactive, runnable TypeScript val by neverstew
neverstew avatar
connect4Agent
@neverstew
HTTP