Search

Results include substring matches and semantically similar vals. Learn more
websandbox avatar
run
@websandbox
An interactive, runnable TypeScript val by websandbox
Script
type SerializedRequest = {
headers: [string, string][];
method: string;
url: string;
body?: string;
type SerializedResponse = {
headers: [string, string][];
status: number;
statusText: string;
body: string;
summerboys avatar
TodoApp
@summerboys
SSR React Mini & SQLite Todo App This Todo App is server rendered and client-hydrated React. This architecture is a lightweight alternative to NextJS, RemixJS, or other React metaframeworks with no compile or build step. The data is saved server-side in Val Town SQLite . SSR React Mini Framework This "framework" is currently 44 lines of code, so it's obviously not a true replacement for NextJS or Remix. The trick is client-side importing the React component that you're server rendering . Val Town is uniquely suited for this trick because it both runs your code server-side and exposes vals as modules importable by the browser. The tricky part is making sure that server-only code doesn't run on the client and vice-versa. For example, because this val colocates the server-side loader and action with the React component we have to be careful to do all server-only imports (ie sqlite) dynamically inside the loader and action , so they only run server-side.
HTTP (deprecated)
# SSR React Mini & SQLite Todo App
This Todo App is server rendered *and* client-hydrated React. This architecture is a lightweight alternative to NextJS, Remix
![demo](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/3bbc3a39-9017-4a95-797b-2f205aa57f00/public)
## SSR React Mini Framework
This ["framework"](https://www.val.town/v/stevekrouse/ssr_react_mini) is currently 44 lines of code, so it's obviously not a
The trick is [client-side importing](https://www.val.town/v/stevekrouse/ssr_react_mini?v=53#L30) the React component that you
/** @jsxImportSource https://esm.sh/react */
export async function loader(req: Request) {
const { sqlite } = await import("https://esm.town/v/std/sqlite?v=4");
const [, { columns, rows }] = await sqlite.batch([
stevekrouse avatar
deno
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP (deprecated)
export default () => Response.json(Deno.version);
g avatar
codepen_debug
@g
An interactive, runnable TypeScript val by g
HTTP (deprecated)
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const id = url.pathname.slice(1);
if (!id) return new Response("go to /{id}");
if (!/^[A-Za-z0-9]+$/.test(id)) return new Response("invalid id");
try {
const pen = await parseCodepen(id);
return new Response(
<!DOCTYPE html>
<html>
beneskildsen avatar
serveHTML
@beneskildsen
An interactive, runnable TypeScript val by beneskildsen
Script
import { html } from "https://esm.town/v/beneskildsen/html";
export const serveHTML = (req, res: express.Response) => {
res.send(html("<b>hello</b> world"));
willthereader avatar
Time_Blindness_Loud_Calendar_via_iOS_shortcuts
@willthereader
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
// Define the route handler function
export const Time_Blindness_Loud_Calendar_via_iOS_shortcuts = (c: Context) => {
console.log("Route accessed: Time_Blindness_Loud_Calendar_via_iOS_shortcuts");
const htmlContent = `
<!DOCTYPE html>
<html>
<head>
<title>Time Blindness Loud Calendar via iOS Shortcuts</title>
<style>
pomdtr avatar
valtownByExample
@pomdtr
Val town by example Usage Simple Example To add an example, just create a val. The val should start with a JSDoc style multi line comment that describes the example: /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. */ // this comment will be displayed on the left export const server = () => new Response("Hello world!") The title is required. Then, you can write the code. Code can be prefixed with a comment that describes the code. The comment will be rendered next to the code in the example page. Make sure your val is public, then go to https://pomdtr-val_town_by_example.web.val.run/v/<your-username>/<your-val> Using multiple vals You can add another val to your example by adding an @include directive /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. * @include pomdtr/secondary_val */ See @pomdtr/react_example Adding external resources to your example You can attach an external link to your val by using the @resource directive. External resources are specified using a markdown link. /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. * @resource [Val Town Docs](https://docs.val.town) **/ Adding examples to the homepage Just add your val in @pomdtr/val_town_by_example_toc
HTTP (deprecated)
# [Val town by example](https://pomdtr-valtownbyexample.web.val.run)
## Usage
### Simple Example
To add an example, just create a val.
The val should start with a JSDoc style multi line comment that describes the example:
```ts
/** @jsxImportSource npm:hono/jsx **/
const self = extractValInfo(import.meta.url);
const app = new Hono();
app.use(
darcy avatar
sus
@darcy
An interactive, runnable TypeScript val by darcy
Script
import process from "node:process";
export let sus = `secret: ${process.env.super_secret}`;
__proto__ avatar
pokeMe
@__proto__
An interactive, runnable TypeScript val by __proto__
Script
let { pokes } = await import("https://esm.town/v/__proto__/pokes");
export function pokeMe() {
pokes = (pokes || 0) + 1;
console.email(pokes);
return pokes;
stevekrouse avatar
rssFeeds
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { inkAndSwitchRssUrl } from "https://esm.town/v/stevekrouse/inkAndSwitchRssUrl";
export const rssFeeds = {
["Ink & Switch"]: inkAndSwitchRssUrl,
["Future of Coding"]:
"https://www.omnycontent.com/d/playlist/c4157e60-c7f8-470d-b13f-a7b30040df73/564f493f-af32-4c48-862f-a7b300e4df49/ac31785
Honestly: "https://feeds.megaphone.fm/RSV2347142881",
colinz avatar
aqi
@colinz
An interactive, runnable TypeScript val by colinz
Cron
export let aqi = async () => {
let pm25 = (
await fetchJSON(
"https://api.openaq.org/v2/latest?" +
new URLSearchParams({
limit: "10",
page: "1",
location: "San Francisco",
offset: "0",
sort: "desc",
hlobil avatar
passkeys_demo
@hlobil
Passkeys Demo Passkeys are pretty neat! I wanted to get a demo working in Val Town so I ported over https://github.com/maximousblk/passkeys-demo. One challenge was that the original extensively uses DenoKV store with compound keys and values. I created @stevekrouse/DenoSyntheticKV as a replacement for DenoKV. It uses SuperJSON to encode the keys and values. You can find the client-side script for the main page here: @stevekrouse/passkey_script
HTTP (deprecated)
# Passkeys Demo
Passkeys are pretty neat! I wanted to get a demo working in Val Town so I ported over https://github.com/maximousblk/passkeys
One challenge was that the original extensively uses DenoKV store with compound keys and values. I created @stevekrouse/DenoS
You can find the client-side script for the main page here: @stevekrouse/passkey_script
/** @jsxImportSource npm:hono@3/jsx */
generateAuthenticationOptions,
generateRegistrationOptions,
verifyAuthenticationResponse,
verifyRegistrationResponse,
} from "https://deno.land/x/simplewebauthn@v10.0.0/deno/server.ts";
nbbaier avatar
PGlite
@nbbaier
PGlite on Val Town - A whole Postgres in your val All you need to do is first import the Deno xmlhttprequest polyfill and then PGlite: import "https://deno.land/x/xhr@0.1.0/mod.ts"; import { PGlite } from "https://cdn.jsdelivr.net/npm/@electric-sql/pglite/dist/index.js"; Importing using esm.sh doesn't seem to work, see https://github.com/electric-sql/pglite/issues/110
HTTP
PGlite on Val Town - A whole Postgres in your val
All you need to do is first import the Deno xmlhttprequest polyfill and then PGlite:
```js
Importing using esm.sh doesn't seem to work, see https://github.com/electric-sql/pglite/issues/110
const pg = new PGlite();
let init = (async () => {
await pg.query(`
CREATE TABLE IF NOT EXISTS test (
id SERIAL PRIMARY KEY,
test TEXT
yawnxyz avatar
geminiBbox
@yawnxyz
Gemini AI Object Detection and Bounding Box Visualizer This application visualizes object detection results by drawing bounding boxes on images using the Google's Gemini 1.5 Pro AI model . Try using this image of 8 bananas, with 1 row and 1/2/4 columns: https://f2.phage.directory/blogalog/bananas-8.png Or this image of a phage plaque assay, with 3x3 grid and high contrast turned on: https://f2.phage.directory/blogalog/pae7.png This app is an adaptation of Simon Willison's idea, which you can read more about here: https://simonwillison.net/2024/Aug/26/gemini-bounding-box-visualization/ API keys are only stored in your browser's local storage. Source code: https://www.val.town/v/yawnxyz/geminiBbox/ Original Source: https://github.com/simonw/tools/blob/main/gemini-bbox.html
HTTP
# Gemini AI Object Detection and Bounding Box Visualizer
This application visualizes object detection results by drawing bounding boxes on images using the [Google's Gemini 1.5 Pro A
Try using this image of 8 bananas, with 1 row and 1/2/4 columns: [https://f2.phage.directory/blogalog/bananas-8.png](https://
Or this image of a phage plaque assay, with 3x3 grid and high contrast turned on: [https://f2.phage.directory/blogalog/pae7.p
This app is an adaptation of Simon Willison's idea, which you can read more about here: [https://simonwillison.net/2024/Aug/2
- API keys are only stored in your browser's local storage.
const intro = `
# Gemini AI Object Detection and Bounding Box Visualizer
This application visualizes object detection results by drawing bounding boxes on images using the [Google's Gemini 1.5 Pro A
Try using this image of 8 bananas, with 1 row and 1/2/4 columns: [https://f2.phage.directory/blogalog/bananas-8.png](https://
parkerdavis avatar
sqliteExplorerApp
@parkerdavis
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 (v66) 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 [ ] 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 [ ] 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 (deprecated)
# SQLite Explorer
View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stev
![image.webp](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/c8e102fd-39ca-4bfb-372a-8d36daf43900/public)
## Install
Install the latest stable version (v66) by forking this val:
[![Install v66](https://stevekrouse-button.express.val.run/Install%20v66)](https://www.val.town/v/stevekrouse/sqlite_explorer
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
EditorSection,
MockTable,
Separator,