Search
createVal
@mharris717
An interactive, runnable TypeScript val by mharris717
Script
privacy?: "public" | "unlisted" | "private"; // Added privacy option
type?: "http" | "script" | "email";
export function createVal({ token, code, name, readme, privacy, type }: CreateValArgs): Promise<ValResponse> {
const body: Record<string, unknown> = {
code,
musicFromPrompt
@insectagon
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [prompt, setPrompt] = useState("");
const [error, setError] = useState("");
async function generateImage() {
setIsLoading(true);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(req: Request): Promise<Response> {
return new Response(`
markovChoice
@jdan
An interactive, runnable TypeScript val by jdan
Script
export function markovChoice(candidates: Record<string, number>) {
const totalWeight = Object.values(candidates).reduce((a, b) => a + b);
let result = null;

notUber
@vawogbemi
notUber -- It's kinda like Lyft I built this as part of a larger project, as well a demo. The stack consists of Clerk for Auth, InstantDB for my database, and the Google maps api for maps and routing etc. All the vals are located here . Getting Started Fork all the vals, the link is here . Refactors the imports so they're importing from your vals and not this val. Visit Clerk , InstantDB , Google maps api and create accounts and get ur api keys. Enter your api Keys into your notUberConsts and notUberMapComponent vals. Follow me on X . THIS IS THE MOST IMPORTANT STEP. Please questions or give feedback!
HTTP
function Container({ children }) {
function MobileNav() {
function DesktopNav() {
function UnauthenticatedApp() {
function Modal({ isOpen, onClose, children }) {
function AuthenticatedApp() {
function App() {
function client() {
export default async function server(request: Request): Promise<Response> {
console.log("Server function called");
nearestOpenStation
@johnmuyskens
An interactive, runnable TypeScript val by johnmuyskens
Script
lon = +lon;
lat = +lat;
function dist(station) {
return Math.sqrt(
Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2)
jokeapi
@kerissa
// Fetches a random joke.
Cron
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",

notify
@samwho
An interactive, runnable TypeScript val by samwho
HTTP
import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
export async function notify(request: Request) {
if (request.method === "OPTIONS") {
return new Response("", {

rime
@zzz
An interactive, runnable TypeScript val by zzz
Script
import { runVal } from "https://esm.town/v/std/runVal";
export async function rime(req, res) {
const url = req.url;
const { text = "Hello World" } = req.query;

whiteThrush
@stevekrouse
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 (v64) by forking this val that imports & exports it in your account: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [ ] improve error handling [ ] improve table formatting [x] make result tables scrollable [ ] sticky table headers [ ] 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 [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add listener for cmd+enter to submit query [ ] 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
HTTP
- [ ] add schema viewing
- [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!)
- [ ] add refresh to table list sidebar after `CREATE/DROP/ALTER` statements
tastefulIvoryWorm
@maxm
An interactive, runnable TypeScript val by maxm
Script
new Promise(r => setTimeout(r, 1000)).then(() => {
console.log("after 1s");
export default async function() {
console.log("from within export");

myApi
@yax
An interactive, runnable TypeScript val by yax
Script
export function myApi(name) {
return "yo " + name;

intellectualMaroonMockingbird
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
function App() {
const [prompt, setPrompt] = useState("hello llamapalooza");
>(null);
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
client();
function extractCodeFromFence(text: string): string {
const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
return htmlMatch ? htmlMatch[1].trim() : text;
export default async function server(req: Request): Promise<Response> {
if (req.method === "POST") {

hololiveAnniversaryIcs
@stu43005
An interactive, runnable TypeScript val by stu43005
HTTP
import process from "node:process";
import { createEvents, EventAttributes } from "npm:ics";
export async function hololiveAnniversaryIcs(req: Request) {
// if (
// req.url