Search

example_rust_val
@saolsen
This val is written in Rust! See This Gist for how to build rust vals.
And https://www.val.town/v/saolsen/use_example_rust_val for an example of how to use it.
Script
let cachedUint8Memory0 = null;
function getUint8Memory0() {
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
return cachedUint8Memory0;
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
export const say_hello = (imports.say_hello = function() {
wasm.say_hello();
* @returns {number}
export const add = (imports.add = function(x, y) {
const ret = wasm.add(x, y);
return ret;
export const __wbg_log_08850d6d4d91f4c9 = (imports.__wbg_log_08850d6d4d91f4c9 = function(arg0, arg1) {
console.log(getStringFromWasm0(arg0, arg1));
aqi
@ProgStudio
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
Script
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
export async function aqi(interval: Interval) {
const location = "mataram ntb indonesia"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
translateTextAPI
@sky_porie_fire443
用于中转谷歌翻译api
HTTP
export default async function server(request: Request): Promise<Response> {
// Handle CORS preflight and OPTIONS requests
if (request.method === "OPTIONS") {
aqi
@burningion
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
export async function aqi(interval: Interval) {
const location = "Brooklyn Navy Yard, Brooklyn"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });

stevekrouse_minimal
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { renderToString } from "npm:react-dom/server";
const linkClass = "text-blue-500 hover:underline";
async function getHits() {
const [, , { rows: [[allHits]] }, { rows: [[todayHits]] }] = await sqlite.batch([
"CREATE TABLE IF NOT EXISTS stevekrouse_com_hits (timestamp DATETIME DEFAULT CURRENT_TIMESTAMP)",
testHTML
@sairamoe
// Forked from @tr3ntg.testHTML
Script
export function testHTML(req: express.Request, res: express.Response) {
res.send(
"<html lang='en'>" +

expressHTMLExample
@octref
// View at https://api.val.town/v1/express/stevekrouse.expressHTMLExample?name=Steve
Script
import { myTestForm } from "https://esm.town/v/octref/myTestForm";
// View at https://api.val.town/v1/express/stevekrouse.expressHTMLExample?name=Steve
export async function expressHTMLExample(req: express.Request, res: express.Response) {
myTestForm.push(req.query.name || req.body.name);
return res.send(`<h1>Hi ${req.query.name || req.body.name}!</h1>`);

pinkGuanaco
@vladimyr
An interactive, runnable TypeScript val by vladimyr
Script
const { greet } = await import(jsm`
export function greet(name) {
console.log(\`Hello \${name}!\`);
const { sum } = await import(tsm`
export function sum(a: number, b: number): number {
return a + b;
const { shout } = await import(createModuleURL(
`export function shout(name: string) {
console.log(\`HELLO \${name.toUpperCase()}!\`);
valle_tmp_272587506760611838217863338600184
@janpaul123
// Respond with fun HTML content and silly gradients on every HTTP request
HTTP
// Respond with fun HTML content and silly gradients on every HTTP request
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<html>
valle_tmp_9687248893374514440365302223592
@janpaul123
// This val responds with "Hello World" to all incoming HTTP requests along with some crazy CSS gradients
HTTP
// This val responds with "Hello World" to all incoming HTTP requests along with some crazy CSS gradients
export default async function main(req: Request): Promise<Response> {
// CSS with crazy gradients
const css = `
bubblyTomatoConstrictor
@orliesaurus
An interactive, runnable TypeScript val by orliesaurus
Cron
export default async function(interval: Interval) {
console.log('hi')
sendNotification
@gwoods22
Push Notification Sender This val can be used in other vals to send notifications to a segment using OneSignal's REST API This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to Netlify for free. OneSignal has easy to follow docs so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then install the PWA on your platform of choice and you're off to the races! Setup Save your ONESIGNAL_TOKEN and SEGMENT_APPID from OneSignal to your Val Town environment variables Import into another val! import sendNotification from "https://esm.town/v/gwoods22/sendNotification";
Script
This val can be used in other vals to send notifications to a segment using [OneSignal's REST API](https://documentation.onesignal.com/reference/create-notification)
This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to [Netlify](https://www.netlify.com/) for free. OneSignal has [easy to follow docs](https://documentation.onesignal.com/docs/web-sdk-setup) so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then [install the PWA](https://www.bitcot.com/how-to-install-a-pwa-to-your-device/) on your platform of choice and you're off to the races!
## Setup

testReceive
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export function testReceive(req, res) {
res.send("ok");
bbrunc
@dglazkov
A simple chat app harness for your board Provides a very simple chat app UI for a Breadboard board. For now, requires you to be running a board server. This harness actually acts
as a proxy to the board server run API endpoint ,
and puts a nice (well, somewhat nice) frontend on top of it. The frontend is somewhat limited in what it can show, currently supporting only
LLMContent and array of LLMContent outputs, and only LLMContent array input. The script will look for the BB_COMMUNITY_KEY in your Val Town environment, which
must contain your board server API key. To use, create an HTTP val, then import the proxy function from this script and call it like this:
import { proxy } from "https://esm.town/v/dglazkov/bbrun";
export default proxy(
"url-to-the-board.bgl.json",
);
Script
must contain your board server API key.
To use, create an HTTP val, then import the `proxy` function from this script and call it like this:
```ts
const DEFAULT_FRONTEND_MODULE = "https://esm.town/v/dglazkov/bbrunfe";
* You can supply these options as a second argument to the `proxy` function.
* These options are used to configure the frontend.
export const proxy = (url: string, options?: FrontendOptions) => {
return async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {