Search

Results include substring matches and semantically similar vals. Learn more
scio avatar
aleister_chatley
@scio
An interactive, runnable TypeScript val by scio
Script
let { aleister_chatley_countdown } = await import("https://esm.town/v/scio/aleister_chatley_countdown");
export const aleister_chatley = async () => {
const prompts = {
aleister_crowley: {
model: "gpt-4",
messages: [
role: "system",
content:
"You're the occultist Aleister Crowley. Be brief and enigmatic.",
role: "user",
brianleroux avatar
scrapecapfriendly
@brianleroux
An interactive, runnable TypeScript val by brianleroux
HTTP (deprecated)
export async function handler(request: Request) {
let url = "https://www.capfriendly.com/";
let res = await fetch(url);
let html = await res.text();
let doc = new DOMParser().parseFromString(html, "text/html");
let table = doc.querySelector("table#cf_homepage__teamTable");
let headers = Array.from(table.querySelectorAll("th")).map(h => h.textContent.trim()).map(e => e === "" ? "?" : e);
let rawRows = Array.from(table.querySelectorAll("tr")).map(r => {
let cells = Array.from(r.querySelectorAll("td"));
console.log(cells);
kamalnrf avatar
sqliteAdmin
@kamalnrf
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,
keenanzucker avatar
surfboardDemoSchedule2
@keenanzucker
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
async function getSchedule() {
try {
const today = new Date();
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
const data = await fetch(
`https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
headers: {
// ADD YOUR API TOKEN INTO THE ENV VARIABLES
jdan avatar
blobImages
@jdan
Image downsizer and uploader
HTTP (deprecated)
# Image downsizer and uploader
/** @jsxImportSource npm:hono@3/jsx */
function esmTown(url) {
return fetch(url, {
headers: {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.142.86 Safari/537
}).then(r => r.text());
const app = new Hono();
export default app.fetch;
stevekrouse avatar
moreBuzz
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
let { fizz } = await import("https://esm.town/v/stevekrouse/fizz");
export const moreBuzz = () => (fizz += "buzz");
tmcw avatar
honoExample
@tmcw
Hono Here's an example using the Hono server library with the Web API . It works great! Server examples Hono Peko Itty Router Nhttp
HTTP (deprecated)
# Hono
Here's an example using the [Hono](https://hono.dev/) server library with the [Web API](https://docs.val.town/api/web). It wo
### Server examples
- [Hono](https://www.val.town/v/tmcw.honoExample)
- [Peko](https://www.val.town/v/tmcw.pekoExample)
- [Itty Router](https://www.val.town/v/tmcw.ittyRouterExample)
const app = new Hono();
app.get("/", (c) => c.text("Hello world!"));
app.get("/yeah", (c) => c.text("Routing!"));
export default app.fetch;
janpaul123 avatar
valle_tmp_0088092323198285537184706961400471
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP (deprecated)
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
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: `Sample Story ${idx + 1}`,
url: `https://example.com/story${idx + 1}`,
votes: Math.floor(Math.random() * 100),
yawnxyz avatar
imageDownSizer
@yawnxyz
Image downsizer and uploader
HTTP (deprecated)
# Image downsizer and uploader
/** @jsxImportSource npm:hono@3/jsx */
function esmTown(url) {
return fetch(url, {
headers: {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.142.86 Safari/537
}).then(r => r.text());
const app = new Hono();
export default app.fetch;
vladimyr avatar
lua_wasi_example
@vladimyr
// console.log(`exit code = ${result.exitCode}`);
Script
const code = `
print(_VERSION)
print("Hello world")
function sum(a, b)
return a + b
end
print(sum(2, 3))
const url = "https://unpkg.com/@antonz/lua-wasi/dist/lua.wasm";
const result = await WASI.start(fetch(url), {
args: ["lua", "/program.lua"],
nbbaier avatar
kyselyVtTypes
@nbbaier
Kysely type generator for @std/sqlite Usage Fork to your account. Update allowedTables to expose any tables you'd like to import the schema of. This will make their schemas public! Add import type { DB } from "https://yourusername-kyselyVtTypes.web.val.run/?tables=tables,you,need" to your program. See that QueryParams` type at the top? Add those to your URL to set more options. Demo See @easrng/kyselyVtDemo.
HTTP
# Kysely type generator for @std/sqlite
## Usage
- Fork to your account.
- Update allowedTables to expose any tables you'd like to import the schema of.
**This will make their schemas public!**
- Add `import type { DB } from "https://yourusername-kyselyVtTypes.web.val.run/?tables=tables,you,need" to your program.
type QueryParams = {
camelCase?: "true" | "false";
excludePattern?: string;
includePattern?: string;
easrng avatar
kyselyVtTypes
@easrng
Kysely type generator for @std/sqlite Usage Fork to your account. Update allowedTables to expose any tables you'd like to import the schema of. This will make their schemas public! Add import type { DB } from "https://yourusername-kyselyVtTypes.web.val.run/?tables=tables,you,need" to your program. See that QueryParams` type at the top? Add those to your URL to set more options. Demo See @easrng/kyselyVtDemo.
HTTP (deprecated)
# Kysely type generator for @std/sqlite
## Usage
- Fork to your account.
- Update allowedTables to expose any tables you'd like to import the schema of.
**This will make their schemas public!**
- Add `import type { DB } from "https://yourusername-kyselyVtTypes.web.val.run/?tables=tables,you,need" to your program.
type QueryParams = {
camelCase?: "true" | "false";
excludePattern?: string;
includePattern?: string;
nmsilva avatar
forbetEventsScrapper
@nmsilva
An interactive, runnable TypeScript val by nmsilva
Script
const forbetEventsScrapper = (html: string, baseUrl: string) => {
const $ = load(html);
const events = [];
$("td.contentmiddle > div > div.schema .rcnt").each((i, el) => {
const bet = $(el).text();
const id = $(el).find(".stcn .nofav.fav_icon").attr("id");
const link = $(el).find(".tnms a").attr("href");
const homeTeam = $(el).find(".tnms .homeTeam").text();
const awayTeam = $(el).find(".tnms .awayTeam").text();
const date = $(el).find(".tnms .date_bah").text();
pomdtr avatar
libsqlstudio_script
@pomdtr
@jsxImportSource https://esm.sh/react@18.3.1
Script
/** @jsxImportSource https://esm.sh/react@18.3.1 */
function App() {
const driver = useMemo(() => {
return new ValtownDriver();
return (
<Studio
driver={driver}
name="Turso Connection"
theme="light"
color="blue"
begoon avatar
ghdb
@begoon
This val implements a simple key/value database with GitHub, in a CRUD way. The key is a file path within a repository. The value is the file content. The val needs a GitHub token to access the GitHub API, the account name and the repository name. Also, the val needs GHDB_API_KEY variable. This value defines the exptected value of the GHDB_API_KEY header to allow access to the endpoints. Endpoints: GET /data/path/to/file.ext - read file GET /raw/path/to/file.ext - read file from GitHub CDN (10 times faster) DELETE /data/path/to/file.ext - delete file POST /data/path/to/file.ext - create file PUT /data/path/to/file.ext - update/commit file
HTTP
This val implements a simple key/value database with GitHub, in a CRUD way.
The key is a file path within a repository. The value is the file content.
The val needs a GitHub token to access the GitHub API, the account name
and the repository name.
Also, the val needs GHDB_API_KEY variable. This value defines the exptected
value of the GHDB_API_KEY header to allow access to the endpoints.
consola.options.formatOptions.columns = 0;
consola.options.formatOptions.compact = false;
export type Data = {
content: string | Uint8Array;
…
60
…
Next