Search

Results include substring matches and semantically similar vals. Learn more
stevekrouse avatar
living
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP
import { html } from "https://esm.town/v/stevekrouse/html";
import { alive as alive2 } from "https://esm.town/v/stevekrouse/alive";
export async function living(req: Request) {
let name = decodeURI(new URL(req.url).pathname.replace("/", ""));
let alive, error;
ugochionyejiaka avatar
scientificSalmonBonobo
@ugochionyejiaka
// Fetches a random joke.
Script
// ... imports ...
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
tay avatar
sqliteExplorerApp
@tay
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/sqliteE
- [x] add listener for cmd+enter to submit query
jkell avatar
myApi
@jkell
An interactive, runnable TypeScript val by jkell
Script
export function myApi(name) {
return "hi " + name + "from" + $me;
luketurner avatar
myApi
@luketurner
An interactive, runnable TypeScript val by luketurner
Script
export function myApi(name) {
return "hi " + name;
karkowg avatar
lazyCook
@karkowg
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [numPeople, setNumPeople] = useState(4);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
function extractJSONFromMarkdown(markdown: string): string {
const jsonMatch = markdown.match(/```json\n([\s\S]*?)\n```/);
return jsonMatch ? jsonMatch[1] : "";
export default async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/recipes") {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const { numPeople, numRecipes, difficulty, cuisine, ingredients, unit, dietaryRestrictions } = await request.json();
try {
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: prompt }],
"content-type": "text/html",
async function generateImage(recipeName: string): Promise<string> {
const response = await fetch(`https://maxm-imggenurl.web.val.run/${encodeURIComponent(recipeName)}`);
dhvanil avatar
web_YrdKpc0KUo
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_YrdKpc0KUo(req) {
return new Response(`<!DOCTYPE html>
<html>
easterc avatar
myApi
@easterc
An interactive, runnable TypeScript val by easterc
Script
export function myApi(name) {
return "hi " + name;
yawnxyz avatar
wahoo
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json( {message: 'hello!!'})
dace avatar
myApi
@dace
An interactive, runnable TypeScript val by dace
Script
export function myApi(name) {
return "hi " + name;
rraval avatar
myApi
@rraval
An interactive, runnable TypeScript val by rraval
Script
export function myApi(name) {
return "hi " + name;
triggatron avatar
myApi
@triggatron
An interactive, runnable TypeScript val by triggatron
Script
export function myApi(name) {
return "hi " + name;
charlesfrisbee avatar
myApi
@charlesfrisbee
An interactive, runnable TypeScript val by charlesfrisbee
Script
export function myApi(name) {
return "hi " + name;
stevekrouse avatar
publicValGetter
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
let { testMutableExample1 } = await import("https://esm.town/v/stevekrouse/testMutableExample1");
export function publicValGetter() {
testMutableExample1++;
testMutableExample1++;
tmcw avatar
brownPelican
@tmcw
An interactive, runnable TypeScript val by tmcw
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })