Search
valle_tmp_39721090126249363719208307534445
@janpaul123
// This val simply responds with "Hello, World!" to any incoming request.
HTTP
// This val simply responds with "Hello, World!" to any incoming request.
export default async function main(req: Request): Promise<Response> {
return new Response("Hello, World!");
myApi
@abeyang
An interactive, runnable TypeScript val by abeyang
Script
export function myApi(name) {
return "hi " + name;
tanCrane
@abhudson3
An interactive, runnable TypeScript val by abhudson3
HTTP
import cheerio from "npm:cheerio";
export default async function mylittlescraper(req) {
console.log(req.params);
const sourceUrl = `https://ssb.ua.edu/pls/PROD/ua_bwckschd.p_disp_detail_sched?term_in=202340&crn_in=43971`;
![saolsen avatar](https://images.clerk.dev/oauth_github/img_2QtXHzN3gDPhKsBOvKsst8LTxC5.png)
connect4_agent_mcts
@saolsen
An interactive, runnable TypeScript val by saolsen
HTTP
const SIMULATIONS = 10000;
function rand_action(state: Connect4State): Connect4Action {
const player = state.active_player;
return action;
function score_action(
current_state: Connect4State,
return score / SIMULATIONS;
function agent(state: Connect4State): Connect4AgentResponse {
// For each action we could take, simulate multiple random games from the resulting state.
tiptapEditorExample
@nbbaier
@jsxImportSource https://esm.sh/preact
HTTP
import tiptapStyle from "https://esm.town/v/nbbaier/tiptapStyle";
import { render } from "npm:preact-render-to-string";
export default async function(req: Request) {
return new Response(
render(
![kf9 avatar](https://images.clerk.dev/oauth_github/img_2SlV5osEnS97KowNFww8ZBUycsX.jpeg)
myApi
@kf9
An interactive, runnable TypeScript val by kf9
Script
export function myApi(name) {
return "hi " + name;
friend
@robh3
An interactive, runnable TypeScript val by robh3
Script
accessKey: Deno.env.get("cloudflareR2Key"), // This stores as secrets in val.town
secretKey: Deno.env.get("cloudflareR2Secret"), // This stores as secrets in val.town
export default async function(req: Request): Promise<Response> {
let currentDate = new Date().toISOString(); // Otherwise, we take the current date
await cloudflareR2client.putObject("transcription-" + currentDate + ".json", req.body);
myApi
@abhudson3
An interactive, runnable TypeScript val by abhudson3
Script
export function myApi(name) {
return "hi " + name;
createGeneratedVal
@andreterron
Use GPT to generate vals on your account! Describe the val that you need, call this function, and you'll get a new val on your workspace generated by OpenAI's API! First, ensure you have a Val Town API Token , then call @andreterron.createGeneratedVal({...}) like this example : @andreterron.createGeneratedVal({
valTownKey: @me.secrets.vt_token,
description:
"A val that given a text file position in `{line, col}` and the text contents, returns the index position",
}); This will create a val in your workspace, and here's the one created by the example above: https://www.val.town/v/andreterron.getFileIndexPosition
Script
# Use GPT to generate vals on your account!
Describe the val that you need, call this function, and you'll get a new val on your workspace generated by OpenAI's API!
First, ensure you have a [Val Town API Token](https://www.val.town/settings/api), then call `@andreterron.createGeneratedVal({...})` like this [example](https://www.val.town/v/andreterron.untitled_tomatoKiwi):
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
import { runVal } from "https://esm.town/v/std/runVal";
export async function createGeneratedVal({ description, valTownKey }: {
description: string;
valTownKey: string;
![sinfulPortkey avatar](https://images.clerk.dev/oauth_github/img_2ShJUVUmw15T7m6P1d0YvvXO0ld.jpeg)
myApi
@sinfulPortkey
An interactive, runnable TypeScript val by sinfulPortkey
Script
export function myApi(name) {
return "hi " + name;
![wilt avatar](https://secure.gravatar.com/avatar/95316a1d4fbd8be9c802a4e1e92fb9e9.jpg?s=200&d=identicon)
sqliteExplorerApp
@wilt
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
HTTP
- [x] make result tables scrollable
- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
- [x] add listener for cmd+enter to submit query
![chad avatar](https://images.clerk.dev/oauth_github/img_2QtMGQbgeqC7mmeJLSDPWHvI1XC.jpeg)
myApi
@chad
An interactive, runnable TypeScript val by chad
Script
import { names } from "https://esm.town/v/chad/names";
export function myApi(req, res) {
names.push(req.query);
return JSON.stringify(req.query);
![pomdtr avatar](https://images.clerk.dev/oauth_github/img_2RCoAITJZH1QencEgtVjh4Qirj4.jpeg)
open_dependency_graph
@pomdtr
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
Script
import { BrowserContext } from "https://esm.town/v/pomdtr/browser";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
export default function(ctx: BrowserContext) {
const { author, name } = extractValInfo(ctx.tab.url);
ctx.open(`https://rlesser-dependency_graph.web.val.run/${author}/${name}`);
myApi
@alejandro
An interactive, runnable TypeScript val by alejandro
Script
export function myApi(name) {
return "hi " + name;
API_URL
@awhitter
Val Town API URL When Val Town code is run on Val Town servers we use a local URL so we can save time by skipping a roundtrip to the public internet. However, if you want to run your vals that use our API, ie std library vals, locally, you'll want to use our public API's URL, https://api.val.town . We recommend importing and using std/API_URL whenever you use our API so that you are always using the most efficient route. Example Usage import { API_URL } from "https://esm.town/v/std/API_URL";
const response = await fetch(`${API_URL}/v1/me`, {
headers: {
Authorization: `Bearer ${Deno.env.get("valtown")}`,
Accept: "application/json",
},
});
const data = await response.json();
console.log(data)
Script
import { val } from 'https://esm.town/v/std/val';
import { OpenAI } from 'https://esm.town/v/std/openai';
// Initialize OpenAI
const openai = new OpenAI();
// Type definitions for Airtable attachments
error?: string;
// Helper function to safely get attachment URL
function getAttachmentUrl(attachments: AirtableAttachment[] | undefined): string {
if (!attachments || !attachments[0]) return '';
// Val Town HTTP Endpoint for Airtable → Framer Fetch
export default async function (req: Request): Promise<Response> {
// Setup CORS Headers for Framer Fetch compatibility
} while (offset);
// Helper function to extract attachment URL
const getAttachmentUrl = (field: any): string => {
Content: ${content.fields["Intro Content"]} ${content.fields["Body Content 1"]} ${content.fields["Body Content 2"]}
const completion = await openai.chat.completions.create({
messages: [
return null;
// Helper functions for AI analysis parsing
const extractTags = (analysis: string): string[] => {