Avatar

wilt

Joined January 12, 2023
Public vals
26
wilt avatar
wilt
pug
Script
Pug HTML Template Renderer This function is equivalent to pug.render - it takes a Pug template string and renders it to an HTML string. import(npm:pug) doesn't work in Val.Town due to Pug's usage of new Function , which is forbidden for security reasons, so this function uses Val.Town's eval API instead. Example const myEndpoint = async (req: express.Request, res: express.Response) => { const html = await @wilt.pug("p Hello #{name}!", {name: "Pug"}); res.status(200); res.send(html); }
0
wilt avatar
wilt
createQdrantCollection
Script
* Create a new Qdrant collection in an existing cluster with the given name * Uses recommended values for OpenAPI embeddings
1
wilt avatar
wilt
getOpenapiEmbedding
Script
* Call OpenAPI Embeddings api to vectorize a query string * Returns an array of 1536 numbers
1
wilt avatar
wilt
emojify
Script
An interactive, runnable TypeScript val by wilt
0
wilt avatar
wilt
toDatesWithTz
Script
An interactive, runnable TypeScript val by wilt
0
wilt avatar
wilt
getOpenMeteoForecast
Script
// See https://open-meteo.com/en/docs for usage
1
wilt avatar
wilt
formatCurrentDatetimeSentence
Script
// Outputs, e.g., "It is currently Sunday, May 21, 2023 at 12:11:04 PM Pacific Daylight Time."
1
wilt avatar
wilt
getWeatherGovData
Script
// Currently broken! Val.Town cannot fetch from .gov sites
1
wilt avatar
wilt
getPodcastAudioUrls
Script
Currently, `parseXML` is a val.town builtin function, which comes from the fast-xml-parser npm package. By default, fast-xml-parser does not return tag attributes - you need to instantiate your own parser object and then call its parse method like so: `new XMLParser({ ignoreAttributes: false }).parse` This constructor does not seem to be exposed in val.town currently. This function returns a list of audio file urls, in the order they appear in the feed. Usually it is safe to assume that the first url is associated with the first episode (by feed order), but this is not guaranteed.
0
wilt avatar
wilt
adcFeed
Script
For ideological reasons, the publisher of this podcast feed opted to include both ogg and mp3 versions of each episode of the podcast. Unfortunately, the podcast spec as defined by Apple does not allow for multiple audio files in a single episode. This val strips out the ogg file, which my podcast player of choice cannot handle, leaving only the mp3 file.
0
Next