Search

Results include substring matches and semantically similar vals. Learn more
yawnxyz avatar
urlMetadata
@yawnxyz
// console.log(await getUrlMetadata('https://arstechnica.com/space/2024/06/nasa-indefinitely-delays-return-of-starliner-to-review-propulsion-data/'))
Script
export async function getUrlMetadata(url) {
try {
const metadata = await urlMetadata(url);
return metadata;
} catch (err) {
console.error('Error fetching metadata:', err);
return null;
// console.log(await getUrlMetadata('https://arstechnica.com/space/2024/06/nasa-indefinitely-delays-return-of-starliner-to-re
// console.log(await getUrlMetadata('https://journals.asm.org/doi/epub/10.1128/aem.00807-24/')); // 403
// console.log(await getUrlMetadata('https://journals.asm.org/doi/10.1128/iai.00065-23')); // 403
pomdtr avatar
serveGithubRepoCli
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
#!/usr/bin/env -S deno run --allow-net
const command = new Command()
.name("serve-gh-repo")
.option("--port <port:number>", "Port to listen on", { default: 8080 })
.option("--ref <ref:string>", "Branch, tag or commit to serve", {
default: "main",
.option("--root <root:string>", "Root directory to serve")
.option("--prefix <prefix:string>", "Prefix to strip from URL")
.arguments("<repo:string>")
.action(({ port, ref, prefix, root }, repo) => {
stevekrouse avatar
whiteXerinae
@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 (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,
lukedenton avatar
sqliteExplorerApp
@lukedenton
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,
saolsen avatar
codemirrorTsBrowserEmacs
@saolsen
codemirror emacs This doesn't work :( I hate it. Gonna have to write my own emacs mode probably, this one (that basically every codemirror based editor uses) is broken.
Script
# codemirror emacs
This doesn't work :( I hate it. Gonna have to write my own emacs mode probably, this one (that basically every codemirror bas
const ret = await build({
dependencies: {
"@codemirror/view": "^6",
"@codemirror/autocomplete": "^6",
"@codemirror/lang-javascript": "^6",
"@codemirror/lint": "^6",
"@codemirror/state": "^6",
"@typescript/vfs": "^1.5.0",
ejfox avatar
allvalsindex
@ejfox
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
// Function to get a random emoji
function getRandomEmoji() {
const emojis = ['😀', '😎', '🤖', '👻', '🚀', '🌈', '🍕', '🎉', '💡', '🔥', '🌟', '🦄'];
return emojis[Math.floor(Math.random() * emojis.length)];
function App() {
const [vals, setVals] = useState([]);
const [error, setError] = useState(null);
const [loading, setLoading] = useState(true);
const handleValClick = (valId) => {
peterqliu avatar
mayor
@peterqliu
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
function handleKeyDown(e) {
alert(JSON.stringify(e));
function App() {
const [collections, setCollections] = React.useState([]);
const [links, setLinks] = React.useState([]);
const [vals, setVals] = React.useState([]);
const [selected, setSelected] = React.useState([]);
const [selectedCollection, setSelectedCollection] = React.useState();
const update = {
ejfox avatar
techstackinventory
@ejfox
* This val creates a tech stack inventory chooser using React and Tailwind CSS for styling. * It allows users to select technologies for different categories and displays the chosen stack.
HTTP
* This val creates a tech stack inventory chooser using React and Tailwind CSS for styling.
* It allows users to select technologies for different categories and displays the chosen stack.
/** @jsxImportSource https://esm.sh/react */
const techCategories = {
frontend: ["React", "Vue", "Angular", "Svelte"],
backend: ["Node.js", "Python", "Ruby", "Java"],
database: ["PostgreSQL", "MongoDB", "MySQL", "SQLite"],
hosting: ["AWS", "Google Cloud", "Heroku", "DigitalOcean"],
function App() {
const [selectedTech, setSelectedTech] = useState({});
thu avatar
sendEmail
@thu
An interactive, runnable TypeScript val by thu
HTTP (deprecated)
import { Hono } from "npm:hono@3";
const app = new Hono();
app.get("/", (c) => {
await email({ text: "emails emails emails!" });
return c.text("Email success!")
export default app.fetch;
ravvi_kumar avatar
tomatoBear
@ravvi_kumar
An interactive, runnable TypeScript val by ravvi_kumar
Script
const basic = (val: number) => (
match(val)
.with(
P.when((_val) => _val % 5 === 0 && _val % 3 === 0),
() => "fizzbuzz",
.with(
P.when((_val) => _val % 5 === 0),
() => "buzz",
.with(
P.when((_val) => _val % 3 === 0),
iamseeley avatar
reactClient
@iamseeley
🌐 Client Side code for the React example
Script
🌐 Client Side code for the React example
* @title React CSR Client in Val Town
* @description Client-side React application for a personal portfolio website.
/** @jsxImportSource https://esm.sh/react */
const Navigation = () => (
<nav>
<NavLink to="/" className={({ isActive }) => (isActive ? 'active' : '')} end>Home</NavLink>
<NavLink to="/projects" className={({ isActive }) => (isActive ? 'active' : '')}>Projects</NavLink>
<NavLink to="/about" className={({ isActive }) => (isActive ? 'active' : '')}>About</NavLink>
</nav>
liamdanielduffy avatar
addReactFromValCDN
@liamdanielduffy
An interactive, runnable TypeScript val by liamdanielduffy
Script
import { scriptTag } from "https://esm.town/v/liamdanielduffy/scriptTag";
export function addReactFromValCDN(): string {
const reactDom = scriptTag({
src: "https://api.val.town/v1/express/liamdanielduffy.REACT_DOM_CDN_VAL",
const react = scriptTag({
src: "https://api.val.town/v1/express/liamdanielduffy.REACT_CDN_VAL",
return [react, reactDom].join(" ");
richardkaplan avatar
helloWorldPDF
@richardkaplan
// View me at https://neverstew-helloWorldPDF.web.val.run
Script
// View me at https://neverstew-helloWorldPDF.web.val.run
export const helloWorldPDF = async (req: Request) => {
const { jsPDF } = await import("npm:jspdf");
const doc = new jsPDF();
doc.text("Hello world - Just a test!", 10, 10);
return new Response(doc.output(), {
headers: { "Content-Type": "application/pdf" },
stevekrouse avatar
axiosEx
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const axiosEx = (async () => {
const { default: axios } = await import("https://esm.sh/axios");
let r = await axios.get("https://api.github.com/users/stevekrouse/following");
return JSON.stringify(r);
aashlayhang avatar
limeNightingale
@aashlayhang
// Fetches a random joke.
Script
export const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
// Fetches a random joke.
async function fetchRandomJoke() {
const response = fetch(
"https://official-joke-api.appspot.com/random_joke",
return response.json();
const randomJoke = fetchRandomJoke();
const setup = randomJoke.setup;