Search
sweetBlackHare
@imnk
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
'en': 'Use clear and professional English medical terminology.'
function SocialShareModal({
analysis,
</div>
function App() {
const [image, setImage] = useState<File | null>(null);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
if (request.method === 'POST' && new URL(request.url).pathname === '/analyze') {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
try {
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
return new Response('Processing timed out', { status: 408 });
console.error('OpenAI processing error:', processingError);
return new Response(
valle_tmp_46416418603901899924834629081321
@janpaul123
// This val responds to HTTP requests with "Hello, World!"
HTTP
// This val responds to HTTP requests with "Hello, World!"
export default async function main(req: Request): Promise<Response> {
return new Response("Hello, World!");
bloodyOliveMollusk
@mmorihara
WIP SQLite graph database based on https://github.com/dpapathanasiou/simple-graph
Script
const searchWhere = (id, key, predicate, tree) =>
`{% if and_or %}{{ and_or }}{% endif %} ${id ? "id = ?" : "" } ${key ? "json_extract(body, '$.${key}') ${predicate} ?" : ""} {% if tree %}AND json_tree.key='{{ key }}' AND {% endif %}json_extract(body, '$.{{ key }}') {{ predicate }} ?{% endif %} {% if tree %}{% if key %}(json_tree.key='{{ key }}' AND {% endif %}json_tree.value {{ predicate }} ?{% if key %}){% endif %}{% endif %}`;
async function executeStatement(statement, args = []) {
return await sqlite.execute({
sql: statement,
args: args,
async function init() {
await sqlite.batch(schema);
![justy avatar](https://images.clerk.dev/oauth_github/img_2SZtz3GBXMYWnJXmoYFlKIn4GQl.jpeg)
myApi
@justy
An interactive, runnable TypeScript val by justy
Script
export function myApi(name) {
return "hi " + name;
CDS_Counter
@toowired
// Define the 5 types of containers acceptable for the Container Deposit Scheme
HTTP
let model;
async function loadModel() {
model = await cocoSsd.load();
loadModel();
self.onmessage = async function(e) {
if (!model) {
const worker = new Worker(workerUrl);
export default async function server(request: Request): Promise<Response> {
if (request.method === "POST") {
headers: { "Content-Type": "application/json" }
// Helper function to map detected objects to acceptable container types
function mapToAcceptableContainer(detectedClass) {
const lowerClass = detectedClass.toLowerCase();
return null; // Not an acceptable container
// Cleanup function to revoke the worker URL when the val is unloaded
globalThis.addEventListener("unload", () => {
// Implementation of sendNotification
async function sendNotification(message) {
try {
// Using Val Town's email functionality:
await email.send({
// Implementation of logDetection
async function logDetection(containers) {
try {
![jnthn avatar](https://secure.gravatar.com/avatar/6ade0c05a2022323308f1e732d1e63c0.jpg?s=200&d=identicon)
myApi
@jnthn
An interactive, runnable TypeScript val by jnthn
Script
export function myApi(name) {
return "hi " + name;
alchemyClient
@jamiedubs
simple wrapper for Alchemy's blockchain APIs , for fetching blockchain data. Ethereum, Solana, etc uses my personal ALCHEMY_API_KEY, I forget if you can use it too or not! get your own if it doesn't work used by some of my other vals: https://www.val.town/v/jamiedubs/nftMetadata etc
Script
import process from "node:process";
type TokenParam = "erc20" | "nft" | string;
export async function alchemyFetch(path: string, tokens: TokenParam = "erc20") {
const apiKey = process.env.ALCHEMY_API_KEY;
if (!apiKey) throw new Error("missing ALCHEMY_API_KEY");
![easrng avatar](https://images.clerk.dev/oauth_github/img_2Qn86tpR8Fwsj1TjoMg9t1DCmc2.png)
moduleFetch
@easrng
An interactive, runnable TypeScript val by easrng
Script
import { AuthTokens } from "https://esm.town/v/easrng/denoAuthTokens";
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");
genimage
@motyar
// This program creates an image generation service using the maxm-imggenurl API.
HTTP
type GeneratedImage = { imageUrl: string; prompt: string };
function App() {
const [prompt, setPrompt] = useState("");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
myApi
@dmac99
An interactive, runnable TypeScript val by dmac99
Script
export function myApi(name) {
return "hi " + name;
valle_tmp_3735050494903109427870190455998034
@janpaul123
// This val will serve an HTML page emulating a Hacker News clone.
HTTP
// It uses plain HTML and CSS to create the frontend. Eventually,
// we can make it interactive with additional scripts.
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
![baj avatar](https://images.clerk.dev/oauth_github/img_2R6MM2fCzIFrGHKka6diXUEjWhy.png)
nyt
@baj
An interactive, runnable TypeScript val by baj
Express (deprecated)
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
export async function nyt(req: express.Request, res: express.Response) {
const data = await fetchText(
"https://cn.nytimes.com/",
CS1200_systemsDev_module
@naman0r
this is my readme.
Script
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
![pomdtr avatar](https://images.clerk.dev/oauth_github/img_2RCoAITJZH1QencEgtVjh4Qirj4.jpeg)
indie_auth
@pomdtr
@jsxImportSource npm:preact
Script
import { render } from "npm:preact-render-to-string";
type HandlerFunc = (req?: Request) => Response | Promise<Response>;
export function indieauth(handler: HandlerFunc, params: {
clientID: string;
}): HandlerFunc {
spacexapi
@moe
An interactive, runnable TypeScript val by moe
HTTP
export default async function(req: Request): Promise<Response> {
export async function getLaunches() {
async function loadPage(url) {
function getRows($, h2Selector, tableSelector, parseFunc) {
rows = rows.filter(function(i, el) {
function parseFutureRows(rows, $) {
rows.each(function(i, el) {
function parsePastRows(rows, $) {
rows.each(function(i, el) {
function getPayloadIcon(text) {