Search

Results include substring matches and semantically similar vals. Learn more
maxm avatar
libraryThatNeedsValidation
@maxm
An interactive, runnable TypeScript val by maxm
Script
export const newClient = async (username: string, password: string): Client => {
const url = `https://${username}-userspaceauth.web.val.run/validate/${password}`;
let resp = await fetch(url);
if (resp.status !== 200) {
throw new Error("Invliad response. Have you set up your fork? https://www.val.town/v/maxm/userspaceauth/fork?");
let data = await resp.json();
if (!data) {
throw new Error("Incorrect password");
return new Client(username);
class Client {
bingo16 avatar
getAdd
@bingo16
An interactive, runnable TypeScript val by bingo16
Script
export let getAdd = async ({ num1, num2 }) => {
console.log("num1:" + num1 + " num2:" + num2);
return parseInt(num1) * parseInt(num2);
jdan avatar
markovOfRandomStrings
@jdan
An interactive, runnable TypeScript val by jdan
Script
import { markovOfStrings } from "https://esm.town/v/jdan/markovOfStrings";
export let markovOfRandomStrings = markovOfStrings([
"onomatopoeia",
"jordan",
"programming",
"typescript",
"markov",
iamseeley avatar
AddLink
@iamseeley
@jsxImportSource https://esm.sh/hono@latest/jsx
Script
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
export default function AddLink({ username }) {
return (
<form action="/links" method="post" id="new-link" hx-push-url={`/edit-profile/${username}`} className="space-y-4">
<input
type="text"
name="label"
placeholder="Link Label"
className="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
<input
andreterron avatar
createVal
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export const createVal = async ({ code, token, name, privacy }: {
code: string;
token: string
name?: string;
privacy?: "public" | "unlisted" | "private";
return fetchJSON("https://api.val.town/v1/vals", {
method: "post",
bearer: token,
body: JSON.stringify({
code,
netux avatar
todepondLabLoginGetUsers
@netux
An interactive, runnable TypeScript val by netux
HTTP (deprecated)
export default async function(req: Request): Promise<Response> {
const TABLE_NAME = "todepond_lab_login_users_with_times";
// get status, name, and last_updated cols
// const query = await sqlite.execute({
// sql: `SELECT status, username, last_updated FROM ${TABLE_NAME}`,
// args: [],
// get status, name, and last_updated cols where banned is zero
const query = await sqlite.execute({
sql: `SELECT status, username, last_updated, banned FROM ${TABLE_NAME} WHERE banned = 0`,
args: [],
neverstew avatar
bbc6MusicSpotifyRedirect
@neverstew
BBC Radio 6 Now Playing on Spotify This uses a fantastic website and pulls a link out of it, automatically redirecting you there. Go straight to https://neverstew-bbc6MusicSpotifyRedirect.web.val.run
HTTP (deprecated)
# BBC Radio 6 Now Playing on Spotify
This uses [a fantastic website](https://6music.sharpshooterlabs.com/) and pulls a link out of it, automatically redirecting y
Go straight to https://neverstew-bbc6MusicSpotifyRedirect.web.val.run
export let bbc6MusicSpotifyRedirect = async (req: Request) => {
const response = await fetch("https://6music.sharpshooterlabs.com/");
const html = await response.text();
const rawUrl = html
.match(/https:\/\/open\.spotify\.com[^\s]+ /)[0]
?.slice(0, -3);
console.info(rawUrl);
mgruel avatar
nominatimSearch
@mgruel
// Forked from @stevekrouse.nominatimSearch
Script
export function nominatimSearch(params: {
q?: string;
street?: string;
city?: string;
county?: string;
state?: string;
country?: string;
postalcode?: string;
return fetchJSON(
"https://nominatim.openstreetmap.org/search?" +
generatecoll avatar
examplePDF
@generatecoll
An example of how to render an invoice using @vtdocs.generateInvoicePDF
HTTP (deprecated)
An example of how to render an invoice using [`@vtdocs.generateInvoicePDF`](https://www.val.town/v/vtdocs.generateInvoicePDF)
// View me at https://vtdocs-examplePDF.express.val.run!
export const examplePDF = async (req: express.Request, res: express.Response) => {
const invoicePDF = generateInvoicePDF({
invoiceNumber: "001",
date: new Date().toDateString(),
customerName: "Alice Bar",
customerEmail: "alice@bar.com",
items: [{ description: "Arabica Beans 500g", quantity: 2, price: 10 }, {
description: "Robusta Beans 500g",
spuckydaslama avatar
todaysDayOfMonth
@spuckydaslama
An interactive, runnable TypeScript val by spuckydaslama
Script
export const todaysDayOfMonth = () => {
return new Date().getDate();
janpaul123 avatar
dummyJustProxyLibsql
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP (deprecated)
import { InStatement, sqlite } from "https://esm.town/v/std/sqlite?v=4";
export default rpc(async (statement: InStatement) => {
try {
return await sqlite.execute(statement);
} catch (e) {
throw new Response(e.message, {
status: 500,
unflat avatar
joinWaitingList
@unflat
An interactive, runnable TypeScript val by unflat
Script
let { waitingList } = await import("https://esm.town/v/unflat/waitingList");
export const joinWaitingList = (req, res) => {
const emailAddress = `${req.query.email}`.toLowerCase();
const emailRegexp =
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-z
if (emailRegexp.test(emailAddress) === false) return;
if (waitingList.indexOf(emailAddress) !== -1) return;
waitingList = `${waitingList},${emailAddress}`;
res.set({ "Content-Type": "application/json" });
res.send({ success: true });
willthereader avatar
FanficSearcherWebsite
@willthereader
// first stable version is 9 and the link is https://www.val.town/v/willthereader/FanficSearcherWebsite?v=9
HTTP
// first stable version is 9 and the link is https://www.val.town/v/willthereader/FanficSearcherWebsite?v=9
function validateConfig(): { appId: string; apiKey: string } {
const appId = Deno.env.get("ALGOLIA_APP_ID_fanficSearcher");
const apiKey = Deno.env.get("ALGOLIA_SEARCH_API_KEY_fanficSearcher");
if (!appId || !apiKey) {
throw new Error("Algolia credentials are not properly set");
return { appId, apiKey };
function generateHtml(appId: string, apiKey: string): string {
console.log("Generating HTML with App ID:", appId, "and API Key:", apiKey ? "exists" : "missing");
return `
enyo avatar
telegramWebhookEchoMessage
@enyo
An interactive, runnable TypeScript val by enyo
HTTP (deprecated)
export const telegramWebhookEchoMessage = async (req: Request) => {
// Verify this webhook came from our bot
if (
req.headers.get("x-telegram-bot-api-secret-token")
!== Deno.env.get("telegramWebhookSecret")
return new Response(undefined, { status: 401 });
// Echo back the user's message
const body = await req.json();
const text: string = body.message.text;
const chatId: number = body.message.chat.id;
pomdtr avatar
sunbeamTrendingRepositories
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { trendingRepositories } from "https://esm.town/v/pomdtr/trendingRepositories";
export async function sunbeamTrendingRepositories() {
const repositories = await trendingRepositories();
const items = repositories.map((repo) => ({
title: repo.name,
subtitle: repo.description || "",
accessories: [`${repo.stargazers_count} *`],
actions: [{ type: "open", target: repo.html_url }],
return { type: "list", items };