Search
groundedIndigoCobra
@toowired
An interactive, runnable TypeScript val by toowired
Script
export const windsurfIDE = {
async executeCommand(command) {
switch(command.type) {
case 'start-goal':
return await this.handleStartGoal(command.goal);
case 'complete-task':
return await this.handleCompleteTask(command.taskId);
case 'auto-next':
return await this.handleAutoNext();
case 'load-memory':
wikidataredirector
@g
Wikidata Website Finder Enter a Wikidata Q-ID to find official websites for organizations, companies, and entities.
HTTP
# Wikidata Website Finder
Enter a Wikidata Q-ID to find official websites for organizations, companies, and entities.
* Wikidata Website Finder
* This service allows users to:
* 1. Search for Wikidata entities
* 2. Retrieve official websites for organizations/entities
* 3. Automatically redirect to the first website if only one exists
* Uses Wikidata's EntityData API to fetch website information
function mainPage() {
<!DOCTYPE html>

similarSites
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
const exaSecret = Deno.env.get("EXA_API_KEY");
const exa = new Exa(exaSecret);
const similarSites = async function(url: string) {
const results = await exa.findSimilar(url);
if (results.results) {
let elements = results.results.map((el) => {
return {
"score": el.score,
"url": el.url,
elements.sort((a, b) => b.score - a.score);

addShortlink
@byjp
Shortlinks for the decentralised web This is a script to allow API-based updating of the shortlinks/redirects in an IPFS-based shortlink repo (using val.town). I've written up how all this works on my blog at https://byjp.me/posts/link-shortener
Express (deprecated)
# Shortlinks for the decentralised web
This is a script to allow API-based updating of the shortlinks/redirects in an IPFS-based shortlink repo (using val.town). I've written up how all this works on my blog at https://byjp.me/posts/link-shortener
export const addShortlink = async (
req: express.Request,
res: express.Response,
const { to } = req.query;
const shortlink = req.path;
if (!/^Bearer github_pat_/.test(req.get("Authorization"))) {
res.status(401).send("Github PAT authentication required");
return;
streamThesaphistRSS
@coofdy
An interactive, runnable TypeScript val by coofdy
Script
import { internalStreamThesephistComRSS } from "https://esm.town/v/coofdy/internalStreamThesephistComRSS";
export let streamThesaphistRSS = async (req, res) => {
res.set("Content-type", "application/rss+xml");
res.set("Cache-Control", "max-age=14400");
res.send(await internalStreamThesephistComRSS);
tidbytCheck
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export async function tidbytCheck({ size = 7, bg = 0x047857ff, check = 0xffffffff }: {
size?: number;
bg?: number;
check?: number;
const img = await tidbytCircle({
size,
fill: 0x14532dc0,
border: 0x047857ff,
const center = Math.floor(size / 2);
img.setPixelColor(check, center - 1, center);
valle_tmp_0112503842756113147839156482696499
@janpaul123
// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
HTTP
// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
export default async function main(req: Request): Promise<Response> {
const response = await fetch("https://www.metaweather.com/api/location/2459115/");
const weatherData = await response.json();
return new Response(JSON.stringify(weatherData), {
headers: { "Content-Type": "application/json" },

slackReplyToMessage
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
export const slackReplyToMessage = async (req: Request) => {
const body = await req.json();
// Verify the request is genuine
if (body.token !== process.env.slackVerificationToken) {
return new Response(undefined, { status: 401 });
// Respond to the initial challenge (when events are enabled)
if (body.challenge) {
return Response.json({ challenge: body.challenge });
// Reply to app_mention events
if (body.event.type === "app_mention") {
getValTownResp
@xiyouMc
An interactive, runnable TypeScript val by xiyouMc
Script
import { getValTown } from "https://esm.town/v/xiyouMc/getValTown";
export let getValTownResp = (async () => {
const s = getValTown;
console.log("aaa", s);
excitedScarletQuail
@charmaine
Framer Fetch: Basic A basic example of an API endpoint to use with Framer Fetch.
HTTP
# Framer Fetch: Basic
A basic example of an API endpoint to use with Framer Fetch.
export default async function(req: Request): Promise<Response> {
// Pick a random greeting
const greetings = ["Hello!", "Welcome!", "Hi!", "Heya!", "Hoi!"];
const index = Math.floor(Math.random() * greetings.length);
return Response.json({ data: greetings[index] });

gfm
@vladimyr
Markdown to html (with github styling)
Script
# Markdown to html (with github styling)
export async function html(markdown: string) {
const [
{ micromark },
{ frontmatter, frontmatterHtml },
{ gfm: gfmMarkdown, gfmHtml },
] = await Promise.all([
import("npm:micromark"),
import("npm:micromark-extension-frontmatter"),
import("npm:micromark-extension-gfm"),
gpt3
@yuval_dikerman
An interactive, runnable TypeScript val by yuval_dikerman
HTTP
export let gpt3 = async (prompt: string, openAiApiKey: string): Promise<string> => {
if (!prompt || !openAiApiKey) {
let cat = await fetch("https://catfact.ninja/fact");
let { fact } = await cat.json();
return Promise.reject(
`Prompt text or api key was not provided. \n \n here's a cat fact: \n ${fact}`,
const content = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
body: JSON.stringify({
model: "gpt-3.5-turbo",

moduleFetch
@easrng
An interactive, runnable TypeScript val by easrng
Script
let cache: [string, AuthTokens] | undefined;
export function moduleFetch(input: RequestInfo | URL, init?: RequestInit | undefined): Promise<Response> {
const req = new Request(input, init);
let authTokens = Deno.env.get("DENO_AUTH_TOKENS");
let valTownToken = Deno.env.get("valtown");
if (typeof authTokens === "undefined" && typeof valTownToken === "string") {
authTokens = `${valTownToken}@esm.town`;
if (typeof authTokens !== "undefined") {
const parsedAuthTokens = (cache && (cache[0] === authTokens))
? cache[1]
excalidrawPass
@all
Excalidraw Document with Authentication User Signup or just password. original excalidraw code import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
import { blob } from "https://esm.town/v/std/blob?v=12";
import { createExcalidraw } from "https://jsr.io/@smallweb/excalidraw/0.3.0/mod.ts";
import { join } from "jsr:@std/path@0.225.2";
const { name } = extractValInfo(import.meta.url);
export default createExcalidraw({
store: {
get: async (key) => {
try {
const res = await blob.get(join(name, key));
return new Uint8Array(await res.arrayBuffer());
} catch (e) {
return null;
}
},
set: (key, value) => {
return blob.set(join(name, key), value);
},
},
});
HTTP
# Excalidraw Document with Authentication
User Signup or just password.
original excalidraw code
const { name } = extractValInfo(import.meta.url);
export default createExcalidraw({
store: {
// This approach adds Lucia authentication with signup to the existing Excalidraw implementation.
// We'll use the luciaMiddleware to handle authentication and redirect unauthenticated users.
// The Excalidraw functionality will only be accessible to authenticated users.
const { name } = extractValInfo(import.meta.url);
bebopBotWebhook
@z233
An interactive, runnable TypeScript val by z233
Script
export async function bebopBotWebhook(
req: express.Request,
res: express.Response
const requestSecretToken =
req?.options?.headers?.["x-telegram-bot-api-secret-token"];
if (requestSecretToken !== bebopBotSecretToken) {
res.status(403).send("Access denied");
return;
const { channel_post: channelPost } = req.body;
if (!channelPost) {