Search

Results include substring matches and semantically similar vals. Learn more
lavacxx avatar
honoTanaEndpoint
@lavacxx
An interactive, runnable TypeScript val by lavacxx
HTTP (deprecated)
const token = Deno.env.get("tanaInputAPI");
export const honoTanaEndpoint = async (req: Request) => {
const app = new Hono();
app.post("/", async c => {
let { text = "" } = await c.req.query();
let node = await c.req.json();
let payload: APIPlainNode;
if (text) {
payload.name = text;
} else if (node) {
tmcw avatar
ascii85example
@tmcw
ascii85 Or Base85 - this is similar to the other z85 example, it just uses different character mappings.
Script
# ascii85
Or Base85 - this is similar to the other z85 example, it just uses different character mappings.
export const ascii85example = (async () => {
const { default: ascii85 } = await import("npm:ascii85");
return ascii85.encode(crypto.randomUUID()).toString();
mattx avatar
scrape_gradio_data
@mattx
scrape_gradio_data Scrapes the gradio_config object from Gradio sites/spaces. Most useful when pointed at a gradio site with lots of static data like the Open LLM Leaderboard
Script
# scrape_gradio_data
Scrapes the gradio_config object from Gradio sites/spaces. Most useful when pointed at a gradio site with lots of static data
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
export const scrape_gradio_data = async (url) => {
const cheerio = await import("npm:cheerio@1.0.0-rc.12");
const html = await fetchText(url);
const $ = cheerio.load(html);
// This is the part most likely to break:
const blob = $("script:nth-of-type(2)").first().text().slice(23, -1);
return JSON.parse(blob);
roramigator avatar
denoBlogAPI
@roramigator
// Scrapes Deno Blog and returns a JSON response with post titles, images, and URLs.
HTTP
// Scrapes Deno Blog and returns a JSON response with post titles, images, and URLs.
export default async function main(req: Request): Promise<Response> {
const url = "https://deno.com/blog";
const response = await fetch(url);
const html = await response.text();
const $ = cheerio.load(html);
const blogPosts = [];
$("a[href^=\"/blog/\"]").each((index, element) => {
const $element = $(element);
const title = $element.find("h3").text().trim();
bert avatar
annotation
@bert
An interactive, runnable TypeScript val by bert
Script
export const annotation = (async () => {
const allmapsAnnotation = await import(
"https://cdn.skypack.dev/@allmaps/annotation@1.0.0-beta.12"
return 8;
janpaul123 avatar
valle_tmp_68349873444339632722229399189495
@janpaul123
// This val responds with "Hello World" to all incoming HTTP requests with crazy CSS gradients
HTTP (deprecated)
// This val responds with "Hello World" to all incoming HTTP requests with crazy CSS gradients
export default async function main(req: Request): Promise<Response> {
const css = `
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
font-size: 36px;
font-weight: bold;
text-align: center;
padding: 50px;
const html = `<div style="${css}">Hello World</div>`;
return new Response(html, { headers: { "Content-Type": "text/html" } });
stevekrouse avatar
magentaTrout
@stevekrouse
@jsxImportSource npm:hono@3/jsx
HTTP (deprecated)
/** @jsxImportSource npm:hono@3/jsx */
const Link = ({ href, children }) => {
return <a href={href} class="text-sky-600 hover:text-sky-500" target="_blank">{children}</a>;
export const Form = (c) =>
c.html(
<form class="max-w-xl mx-auto bg-white p-6 rounded">
<h2 class="text-2xl mb-4 font-semibold text-gray-800">Submit Your Date Me Doc</h2>
<div class="mb-4">
<label for="name" class="block text-gray-700 font-bold mb-2">
Name<span class="ml-1 text-red-500 ">*</span>
vladimyr avatar
midnightpubFeed
@vladimyr
// @see: https://git.sr.ht/~m15o/midnight-pub/tree/master/item/model/user.go#L28
HTTP (deprecated)
const BASE_URL = "https://midnight.pub";
// @see: https://git.sr.ht/~m15o/midnight-pub/tree/master/item/model/user.go#L28
const reUserFeed = /^\/(?<username>~[a-z0-9-_]+)\.(?<format>atom|rss)$/;
export default async function(req: Request): Promise<Response> {
const { pathname } = new URL(req.url);
const match = pathname.match(reUserFeed);
if (!match) {
return new Response(null, { status: 400 });
const { format, username } = match.groups;
const profileURL = new URL(`/${username}`, BASE_URL);
politelyinvinciblepointer avatar
increaseinnerfeelingscounter
@politelyinvinciblepointer
An interactive, runnable TypeScript val by politelyinvinciblepointer
Script
let { innerfeelingscounter } = await import("https://esm.town/v/politelyinvinciblepointer/innerfeelingscounter");
export function increaseinnerfeelingscounter() {
innerfeelingscounter++;
stevekrouse avatar
qr
@stevekrouse
// Forked from @ramkarthik.GenerateQR
Express
export async function qr(req: express.Request, res: express.Response) {
if (req.path.startsWith("/qr")) {
const { qrcode } = await import("https://deno.land/x/qrcode/mod.ts");
const base64Image = await qrcode(req.query.data);
res.set("content-type", "image/gif");
res.send(
Buffer.from(base64Image.replace("data:image/gif;base64,", ""), "base64"),
else {
res.send(`<html>
<div>
ttodosi avatar
sqliteExplorerApp
@ttodosi
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 (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 (v86) by forking this val:
[![Install Stable Release (v86)](https://stevekrouse-button.express.val.run/Install%20Stable%20Release%20(v81))](https://www.
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
EditorSection,
MockTable,
Separator,
yawnxyz avatar
honoAlpineHtmxDemo
@yawnxyz
This example shows how Hono, Alpine, and Htmx can play together. Alpine is great at reactive client-side updates Htmx is great at sending/receiving content from server These two can be combined for reactive clients plus easy AJAX
HTTP (deprecated)
This example shows how Hono, Alpine, and Htmx can play together.
- Alpine is great at reactive client-side updates
- Htmx is great at sending/receiving content from server
- These two can be combined for reactive clients plus easy AJAX
const app = new Hono();
// Endpoint to catch and log the submitted name
app.post("/submit-name", async (c) => {
const data = await c.req.parseBody();
console.log('data:', data, Object.keys(data));
console.log("Received name:", data.name);
samwillis avatar
PGliteOld
@samwillis
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
rickygrassmuck avatar
staticChess
@rickygrassmuck
Static Chess Check it out here: https://chess.maxmcd.com Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves? Functionality is quite limited, and things might be broken. Please let me know if you find bugs! Inspired by this HN discussion about sites that have all possible game states of tic-tac-toe. I plan on extending this to support real gameplay. I think it could be a nice simple interface for long form games with friends. Might also be fun to add a static AI to play against. Feel free to PR any changes if you'd like to see something added.
HTTP (deprecated)
# Static Chess
![chess](https://i.imgur.com/wZGN8G6.gif)
Check it out here: https://chess.maxmcd.com
Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link
Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game state
/** @jsxImportSource https://esm.sh/react */
class StaticChess {
size = 8;
rows = Array.from({ length: this.size }, (_, i) => i);
jpaulgale avatar
sqliteExplorerApp
@jpaulgale
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 (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 (v86) by forking this val:
[![Install Stable Release (v86)](https://stevekrouse-button.express.val.run/Install%20Stable%20Release%20(v81))](https://www.
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
EditorSection,
MockTable,
Separator,