Back to APIs list

Air quality API examples & templates

Use these vals as a playground to view and fork Air quality API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
stevekrouse avatar
stevekrouse
dm
Script
DM Me! Ever wanted to message someone about their val but you couldn't find their contact info? Want to allow folks on Val Town to contact you without exposing your email address? Boy do I have the over-engineered solution for you! This is a userspace, authenticated protocol for Val Town direct messages. Protocol Expose a dm function on your namespace that that accepts messages and some authentication data (described below). The easiest way to accomplish this is to fork this val. What you choose to do with direct messages is totally up to you. At the moment, I email myself your message and save it to a private array val. You could forward it along to yourself some other way, batch up messages to get a daily summary email if you're Mr. Popular, or send them to /dev/null if you're Mr. Antisocial. Authentication This protocol uses my Val Town public key auth scheme , so you'll need to follow the first two steps of that blog post – (1) generate a keypair and (2) publish your public key – to authenticate to this function. Usage You can call this function via the @stevekrouse.runValAPIAuth helper: @stevekrouse.runValAPIAuth({ val: "@stevekrouse.dm", args: ["hi steve!"], keys: @me.exportedKeys, }); Example: https://www.val.town/v/stevekrouseTest.untitled_tealMinnow
0
tmcw avatar
tmcw
typeboxTest
Script
An interactive, runnable TypeScript val by tmcw
0
talha_husnain avatar
talha_husnain
First
Script
// Track which players have folded
0
karfau avatar
karfau
aoc23_07
Script
Forked from karfau/aocXX_00
0
vladimyr avatar
vladimyr
jwkToDidKey_tests
Script
// @see: https://w3c-ccg.github.io/did-method-key/#example-5
0
nickfrosty avatar
nickfrosty
blink_create_tree
Script
* Solana Actions Example
0
vesty91 avatar
vesty91
depannageInformatique
Script
@jsxImportSource https://esm.sh/react@18.2.0
0
all avatar
all
saveAsPDF
Script
Forked from iamseeley/savePDF
0
sairamoe avatar
sairamoe
testHTML
Script
Forked from tr3ntg/testHTML
0
richi1969 avatar
richi1969
findingsvgfiles
HTTP
@jsxImportSource https://esm.sh/react
0
stu43005 avatar
stu43005
hololiveAnniversaryData
Script
Data Source: https://seesaawiki.jp/hololivetv/d/%B5%AD%C7%B0%C6%FC Auto gen by @stu43005.genHololiveAnniversaryData
0
easrng avatar
easrng
valSign
Script
secure signatures with vals setup you'll need to make 2 new vals: generate a keypair (keep this val private) let vsExportedKeys = @easrng.generateKeys(); publish your public key (make this val public) const vsPublicKey = () => @me.exportedKeys.publicKey; usage sign call @easrng.valSign to get a signature. const signature = await @easrng.valSign({ keys: @me.vsExportedKeys, data: {hello: "world"}}) the result will look something like this: @easrng.htVgaVWWtvnz5AK0DnDaNON5gar5qJeaorfsTCiIr7ua_-D4HPmFrIrPMfwmCaMvI0CxKlYCUe9XTGm7r5s5C3siZGF0YSI6eyJoZWxsbyI6IndvcmxkIn0sInVzZXIiOiJlYXNybmciLCJleHByIjpudWxsfQ you can also set an expiration date: const signature = await @easrng.valSign({ keys: @me.vsExportedKeys, data: "this expires in 1 second", expireIn: 1000 }) verify call @easrng.valSignVerify to verify a signature const { data, handle, expiresAt } = await @easrng.valSignVerify(signature) with the example signature from earlier, data would be {hello: "world"} , handle would be easrng , and expiresAt would be null
2
torlanco avatar
torlanco
shirtGenScript
HTTP
👕 Shirtgen API Endpoint Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between the standard "Flux Schnell" model or the enhanced "Pro" model. Perfect for creating unique custom apparel in seconds! 🚀 💡 How it Works Send a POST request to the endpoint with your design prompt. Toggle between Standard and Pro models using the useProModel flag. The AI generates a high-quality t-shirt design based on your prompt. 📥 Expected POST Data { "prompt": "A retro sunset with palm trees 🌴🌅", "useProModel": true }
0
deeplyscenery avatar
deeplyscenery
pokenames
Script
// Generates 10 random Pokemon names
1
torlanco avatar
torlanco
shirtGen
HTTP
👕 Shirtgen Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between Flux Schnell or the Pro model for enhanced results, and watch AI bring your ideas to life in seconds. Perfect for creating custom apparel effortlessly! 🚀 How it Works Enter a prompt describing your design. Toggle between Standard and Pro models. Hit "Generate" to see your AI-crafted t-shirt design appear! Image Generation Sources With Replicate API Key : Uses Replicate Hosted Flux models for high-quality designs. Without Replicate Key : Falls back to a Val.town image generator for quick designs. Requirements Optional Replicate API Key : To use the advanced models, set REPLICATE_API_KEY in your environment.
0
shawnbasquiat avatar
shawnbasquiat
placeholderImages
HTTP
// This val creates a kitten image generator using the Val Town image generation API.
1