Search

Results include substring matches and semantically similar vals. Learn more
rodrigotello avatar
timeAgoAsConst
@rodrigotello
An interactive, runnable TypeScript val by rodrigotello
Script
export const timeAgoAsConst = (async () => {
const { timeAgo } = await import("https://deno.land/x/time_ago/mod.ts");
return timeAgo(new Date("2023-05-21T05:44:55.000Z"));
reedrosenbluth avatar
watchWebsite
@reedrosenbluth
An interactive, runnable TypeScript val by reedrosenbluth
Cron
export const watchWebsite = async () => {
const url = "https://www.margarethowell.co.uk/us/men/shop/shoes/raw-edge-derby-leather-black";
const newHtml = await fetch(url).then(r => r.text());
const key = "watch:" + url;
let oldHtml = "";
try {
oldHtml = await blob.get(key).then(r => r.text());
} catch (error) {
console.log("error");
await blob.set(key, newHtml);
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)
# 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,
stevekrouse avatar
dailyDadJoke
@stevekrouse
Daily Dad Joke How do you make a programmer laugh every morning? A dad joke cron job! Setup Fork this val Click Create fork 🤣🤣🤣🤣 API This val uses the icanhazdadjoke API . You can find more docs here , such as how to filter by type .
Cron
# Daily Dad Joke
How do you make a programmer laugh every morning?
A dad joke cron job!
## Setup
1. [Fork this val](https://www.val.town/v/stevekrouse/dailyDadJoke/fork)
2. Click **Create fork**
export async function dailyDadJoke() {
let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
return email({
text: punchline,
janpaul123 avatar
valle_tmp_109048913203484876323222261393799
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP (deprecated)
const SAMPLE_STORIES_KEY = "hn_realistic_sample_stories";
// Initialize sample stories and store them in blob storage
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
const sampleStories = Array.from({ length: 30 }).map((_, idx) => ({
id: idx + 1,
title: faker.company.catchPhrase(),
url: faker.internet.url(),
votes: Math.floor(Math.random() * 100),
cjlm avatar
sqliteExplorerApp
@cjlm
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,
triptych avatar
smileyPNG
@triptych
Render a PNG This tiny smiley face is rendered by this val: The image response is cached by the CDN, so make sure to change the image name if you make code changes. Any name with a .png extension will work: https://maxm-smileypng.web.val.run/-.png
HTTP (deprecated)
# Render a PNG
This tiny smiley face is rendered by this val: ![](https://maxm-smileypng.web.val.run/-.png)
The image response is cached by the CDN, so make sure to change the image name if you make code changes. Any name with a `.pn
export const smileyPNG = async (request: Request) => {
const { encode } = await import("https://deno.land/x/pngs/mod.ts");
// Dimensions of the image
const [width, height] = [10, 10];
// Create our PNG canvas
const imageData = new Uint8Array(width * height * 4);
const y = [255, 255, 0, 255]; // Yellow
vtdocs avatar
browserlessScrapeExample
@vtdocs
An interactive, runnable TypeScript val by vtdocs
Script
export const browserlessScrapeExample = (async () => {
const res = await fetchJSON(
`https://chrome.browserless.io/scrape?token=${process.env.browserlessKey}`,
method: "POST",
body: JSON.stringify({
"url": "https://en.wikipedia.org/wiki/OpenAI",
"elements": [{
// The second <p> element on the page
"selector": "p:nth-of-type(2)",
// For this request, Browserless returns one data item
roramigator avatar
moodTracker
@roramigator
// This mood tracker will use a GitHub-like contribution table to visualize mood entries.
HTTP
// This mood tracker will use a GitHub-like contribution table to visualize mood entries.
// We'll use SQLite for persistence, emojis for mood input, and implement a 4-hour cooldown.
// The dashboard will display the contribution table and some basic stats.
/** @jsxImportSource https://esm.sh/react */
const MOODS = ["😄", "😊", "😐", "😕", "😢"];
function App() {
const [moodData, setMoodData] = useState([]);
const [lastEntry, setLastEntry] = useState(null);
const [stats, setStats] = useState({});
useEffect(() => {
samhashemi avatar
testing
@samhashemi
// import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
HTTP (deprecated)
// import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
// export let comments = ["hello world!"];
// export let twitterJSON = ({ url, bearerToken }) =>
// fetchJSON(
// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
// export function handler(request: Request) {
// let elements = fetchJSON(
// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
nickgolden avatar
sqliteExplorerApp
@nickgolden
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,
neverstew avatar
shortId
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
export const shortId = async (size?: number) => {
const { customAlphabet } = await import("npm:nanoid");
const nanoid = customAlphabet(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
return nanoid(size);
mrdrone avatar
sqliteExplorerApp
@mrdrone
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,
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)
# 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,
stevekrouse avatar
amaranthYak
@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,