Search
getValsContextWindowDebug
@janpaul123
// This val renders the output of "janpaul123/getValsContextWindow" as HTML
HTTP
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
const { owner, name } = extractValInfo(import.meta.url);
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const model = url.searchParams.get('model') || 'gpt-4o';
val_aTGXLrIVAG
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
iheartjankboteko1
@iheartjankboteko
// Fetches a random joke.
Script
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
pingNations
@bohaska
Automatically answers issues from NationStates using AI sentiment analysis, for free! Requires: Huggingface token (HF_TOKEN) for the sentiment analysis of options. Generate a read-only token at Huggingface after making an account to use. Email address (EMAIL) for user agent. Required as per NationStates ToS Autologin token (AUTOLOGIN) for logging into NationStates. See NationStates API docs for more info. Nation name (NATION_ID). Put your nation name, the one you use when you login to your account. Selects the option with the highest positivity score. Feel free to adapt the algorithm to your own tastes. See the Republic of Positivum for an example of this val in action.
Cron
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
export default async function(interval: Interval) {
const nations = Deno.env.get("PING_NATIONS").split(",");
const passwords = Deno.env.get("PING_NATIONS_PASSWORD").split(",");
pekoExample
@tmcw
peko This is an example of using the tiny peko example with Val Town - it's a small router that lets you build web apps using the standard Request & Response objects. Peko just provides routing - matching URLs with functions - and lets you create your own Response object. Server examples Hono Peko Itty Router Nhttp
HTTP
This is an example of using the tiny [peko](https://peko.deno.dev/) example with Val Town - it's a small router that lets you build web apps using the standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) & [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects.
Peko just provides routing - matching URLs with functions - and lets you create your own Response object.
### Server examples
RareVibesBoost
@RareVibesAiDad
Rarevibes is not responsible of any database loss
Script
import { OpenAI } from "https://esm.town/v/std/openai";
async function generateDataScienceToolReport() {
const openai = new OpenAI();
async function generateOperationalInsights(category: string) {
const operationalCompletion = await openai.chat.completions.create({
"Cross-functional team alignment",
async function exportOperationalReportToJSON() {
async function generateComprehensiveOperationalAnalysis() {
function calculateOperationalReadinessScore(tool) {
function OperationalToolDashboard() {
linkInBioTemplate
@opeala
@jsxImportSource https://esm.sh/react
HTTP
import { FontAwesomeIcon } from "npm:@fortawesome/react-fontawesome";
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
renderToString(

yourBrain
@petermillspaugh
@jsxImportSource https://esm.sh/react
Script
<h2>The basal ganglia</h2>
<p>
The basal ganglia, which also controls some motor function—both voluntary and unvoluntary, like subconscious eye
movements, Cognitive and motor functions can be chunked together in one unit that makes up a learned habit or
skill. So you can think of learned habits become automatic, uncontrolled System 1 knowledge.
It kind of looks like an over-ear bluetooth thingy. TODO: image/diagram
val_fM7f5WnH8f
@dhvanil
An interactive, runnable TypeScript val by dhvanil
Script
export default async function handler(req) {
try {
return Response.json({ success: true });

denoGameHTML
@rodrigotello
An interactive, runnable TypeScript val by rodrigotello
Express (deprecated)
JSON.stringify(dinoGameScoreboard)
function setup() {
createCanvas(800, 300);
resetGame();
function resetGame() {
dino = new Dino();
gamePaused = false;
function draw() {
if (isGameOver) {
console.log("Current Score:", score);
function keyPressed() {
if (keyCode === 32) {
dino.jump();
function gameOver() {
isGameOver = true;
scoreboard.push({ name, score });
// Call the function to update the scoreboard on the Val Town API
updateScoreboard(name, score);
function updateScoreboard(name, score) {
const apiUrl =
console.error("Error updating scoreboard:", error);
function showGameOver() {
background(255);
yPos += 20;
function showGamePaused() {
background(255);
renderFormAndSaveData
@andreterron
Render form and save data This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data. Fork this val to customize it and use it on your account.
HTTP
# Render form and save data
This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data.
Fork this val to customize it and use it on your account.

myApi
@marydotdev
An interactive, runnable TypeScript val by marydotdev
Script
export function myApi(name) {
return "hi " + name;
valle_tmp_86768439956087117587941274446584
@janpaul123
// This val will respond to any request with an HTML "Hello, world!" message with some fun CSS styles and an animated cat
HTTP
// This val will respond to any request with an HTML "Hello, world!" message with some fun CSS styles and an animated cat
export default async function(req: Request): Promise<Response> {
const html = `
<html>
valle_tmp_89429840600482986700048825640037
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
export default async function main(req: Request): Promise<Response> {
const html = `
<!DOCTYPE html>

chatWithCerebras
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP
import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
export default async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
const formData = new URLSearchParams(url.search);