Search

Results include substring matches and semantically similar vals. Learn more
neverstew avatar
preactTest
@neverstew
An interactive, runnable TypeScript val by neverstew
HTTP (deprecated)
export const preactTest = async () => {
const { useState, h, htm, renderToString } = await import(
"https://npm.reversehttp.com/preact,htm,preact/hooks,preact-render-to-string"
const html = htm.bind(h);
function Component() {
yawnxyz avatar
webgen
@yawnxyz
To-dos: Spruce up styles a bit Write this README ~Add a cache!~ ~Try moving style tag to the bottom by prompting so content appears immediately and then becomes styled~ didn't work b/c CSS parsing isn't progressive Need more prompting to get the model not to generate placeholder-y content Better root URL page / index page with links to some good sample generations
HTTP (deprecated)
Your description should include:
- What content is on the page
- Other elements like sidebars, links, images that may be in the page
- The author and origin of the page
- The stylistic aesthetic of the page
rayman avatar
HTMXQuill
@rayman
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
// import Quill from "npm:quill";
export default async function(req: Request) {
willthereader avatar
chocolateCanid
@willthereader
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events.
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { OpenAI } from "https://esm.town/v/std/openai";
import { Hono } from "npm:hono@3";
import { renderToString } from "npm:react-dom/server";
const openai = new OpenAI();
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
const clientCode = () => {
document.getElementById("input").addEventListener("submit", async function(event) {
</form>
<script dangerouslySetInnerHTML={{ __html: `(${clientCode.toString()})()` }}>
</script>
janpaul123 avatar
valle_tmp_54185991019187464068579562776686
@janpaul123
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import valleGetValsContextWindow from "https://esm.town/v/janpaul123/valleGetValsContextWindow";
import archiveVal from "https://esm.town/v/nbbaier/archiveVal?v=10";
import _ from "npm:lodash@4";
import OpenAI from "npm:openai";
import { renderToString } from "npm:react-dom/server";
// Set these to your own
const username = "janpaul123";
avycado13 avatar
sqliteExplorerApp
@avycado13
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)
- [ ] 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
return c.render(
<main class="sidebar-layout">
<div class="sidebar">
<TablesList tables={[...tables, ...views]}></TablesList>
<Separator direction="horizontal"></Separator>
<div class="not-sidebar">
<EditorSection />
saludes avatar
linkInBioTemplate
@saludes
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
stevekrouse avatar
remark
@stevekrouse
@jsxImportSource https://esm.sh/preact
Script
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
export const remark = ({ title, content }) => async (req: Request) =>
new Response(
jxnblk avatar
contrast_swatch
@jxnblk
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
import { Color } from "https://deno.land/x/color/mod.ts";
import { render } from "https://deno.land/x/resvg_wasm/mod.ts";
import { render as preact } from "npm:preact-render-to-string";
const HEXRE = /^[A-Fa-f0-9]{3,6}$/;
const text = data.contrast.toFixed(2);
const svg = preact(
<svg
willthereader avatar
valTownChatGPT
@willthereader
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import OpenAI from "npm:openai";
import { renderToString } from "npm:react-dom/server";
const openai = new OpenAI();
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
const clientCode = () => {
document.getElementById("input").addEventListener("submit", function(event) {
</form>
<script dangerouslySetInnerHTML={{ __html: `(${clientCode.toString()})()` }}>
</script>
yawnxyz avatar
sqliteExplorerApp
@yawnxyz
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)
- [ ] 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
return c.render(
<main class="sidebar-layout">
<div class="sidebar">
<TablesList tables={[...tables, ...views]}></TablesList>
<Separator direction="horizontal"></Separator>
<div class="not-sidebar">
<EditorSection />
benlenarts avatar
SongTagger
@benlenarts
Spotify Playback A val to setting up some endpoints for Spotify play state.
HTTP (deprecated)
export let spotifyRequestToken = ({ client_id, client_secret, code, redirect_uri }) =>
"Authorization": "Basic " + (new Buffer(client_id + ":" + client_secret).toString("base64")),
export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
"Authorization": "Basic " + (new Buffer(client_id + ":" + client_secret).toString("base64")),
`https://accounts.spotify.com/authorize?response_type=code&client_id=${
encodeURIComponent(Deno.env.get("SPOTIFY_CLIENT_ID"))
client_id: Deno.env.get("SPOTIFY_CLIENT_ID"),
client_secret: Deno.env.get("SPOTIFY_CLIENT_SECRET"),
client_id: Deno.env.get("SPOTIFY_CLIENT_ID"),
client_secret: Deno.env.get("SPOTIFY_CLIENT_SECRET"),
burcs avatar
sqliteExplorerApp
@burcs
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)
- [ ] 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
return c.render(
<main class="sidebar-layout">
<div class="sidebar">
<TablesList tables={[...tables, ...views]}></TablesList>
<Separator direction="horizontal"></Separator>
<div class="not-sidebar">
<EditorSection />
peterhartree avatar
sqliteExplorerApp
@peterhartree
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)
- [ ] 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
return c.render(
<main class="sidebar-layout">
<div class="sidebar">
<TablesList tables={[...tables, ...views]}></TablesList>
<Separator direction="horizontal"></Separator>
<div class="not-sidebar">
<EditorSection />
jxnblk avatar
dotcom
@jxnblk
Overengineered personal site and blog built on Val Town. https://jxnblk.com I started rebuilding my site using Val Town with the intent to create a val that would fetch static HTML and commit to a GitHub repo to host with gh-pages. After building the site out, I found that the performance seemed good enough – at least in the US – to host it directly on Val Town. How it works The old site still exists at on GitHub at jxnblk/blog and includes the source markdown files, build script, and static JSON API. I experimented with storing JSON in Val Town storage, but for now, the site imports a static JSON file for content. This content is passed to the App React component that includes the entire HTML and handles routing. The component is rendered using ReactStream which can render React to stream in Val Town and hydrate the component in the browser. For performance reasons, I'm not using React on the client, but using small vanilla JS scripts to handle color modes. ReactStream also accepts middleware, and this site uses middleware to: Record server analytics in Val Town SQLite Respond to /robots.txt Handle redirects Generate an /rss.xml file Pass the blog content as props to the App component Set cache headers The favicon, avatar image, and OG images are also built in Val Town. The avatar val exports an Avatar React component that's used in the site and exposes an image service at https://jxnblk-avatar.web.val.run/ that accepts search parameters. This image service is used for the site's favicon. The blogOGImage val is used to generate PNG OG images from SVG and take search parameters to make dynamic images for each blog post. Styling is handled by importing CSS from JxnblkCSS and rendering an inline <style> tag in the HTML head. I experimented with some other approaches, but this seemed to be the simplest solution. What's next There are still some content issues in the markdown that need to be updated for the new site and there are likely bugs to fix. If you spot anything, you can leave a comment on this val below. I experimented with a few different approaches and plan to consolidate JxnblkApp and this val and clean up some of the structure of the site. I started building out a custom Reddit embed widget to help with front-end performance, but it's buggy and needs some work. I'd also like to build a custom Val Town embed widget to add custom demo vals to future posts, but that's still a work in progress. Let me know what you think of the site so far, and if you have any ideas on how to make this better, I'd love to hear them!
HTTP
This content is passed to the [App][JxnblkApp] React component that includes the entire HTML and handles routing.
The component is rendered using [ReactStream][] which can render React to stream in Val Town and hydrate the component in the
For performance reasons, I'm not using React on the client, but using small [vanilla JS scripts][jxnblkioVanillaJS] to handle
ReactStream also accepts middleware, and this site uses middleware to:
The [avatar][] val exports an `Avatar` React component that's used in the site and
/** @jsxImportSource https://esm.sh/react */
import { MdContrast } from "https://esm.sh/react-icons/md";
import React from "https://esm.sh/react@18.3.1";
import { useMemo, useState } from "https://esm.sh/react@18.3.1";
import { DataRequest, render, robots } from "https://esm.town/v/jxnblk/ReactStream";