Search

Results include substring matches and semantically similar vals. Learn more
dthyresson avatar
movieMashup
@dthyresson
Movie Mashup It's Blader Runner meets Pretty in Pink. OpenAI generated movie maship title, tagline and treatments. Fal generated movie posters.
HTTP
# Movie Mashup
It's Blader Runner meets Pretty in Pink.
OpenAI generated movie maship title, tagline and treatments.
Fal generated movie posters.
/** @jsxImportSource npm:hono@3/jsx */
movieMashupMashupRoute,
movieNewMashupMashupRoute,
} from "https://esm.town/v/dthyresson/movieMashupMashupRoute";
const app = new Hono();
homeRoute(app);
janpaul123 avatar
valle_tmp_342713532081501576880417370490928
@janpaul123
* This val creates a simple comment box using an HTML form. When a comment is submitted, * it stores the comment in a SQLite database and then displays all the comments. * We use the built-in database functions from Val Town.
HTTP
* This val creates a simple comment box using an HTML form. When a comment is submitted,
* it stores the comment in a SQLite database and then displays all the comments.
* We use the built-in database functions from Val Town.
// Initialize the database and create the table if it doesn't exist
await sqlite.execute(`
CREATE TABLE IF NOT EXISTS comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
content TEXT,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
// Handle requests
ralfw avatar
curveMinusServer
@ralfw
An interactive, runnable TypeScript val by ralfw
Script
export const curveMinusServer = async (req: Request) => {
const { Hono } = await import("npm:hono");
const app = new Hono();
app.get("/calc", (c) => {
const x = parseFloat(String(c.req.query("x")));
const y = curveMinus(x);
return c.json({ result: y });
app.get("/ai-plugin.json", (c) => c.text(curveMinusManifest));
app.get("/openapi.yaml", (c) => c.text(curveMinusOpenAPI));
return app.fetch(req);
g avatar
dcpterodeploycall
@g
An interactive, runnable TypeScript val by g
Script
await fetch(
'https://g-dcptero.web.val.run/dc/register?key='
+ encodeURIComponent(Deno.env.get('valtown')),
).then((res) => res.json()).then(console.log);
jamiedubs avatar
simpleJsonReply
@jamiedubs
// View at https://stevekrouse-expressHTMLExample.express.val.run?name=Steve
Express (deprecated)
// View at https://stevekrouse-expressHTMLExample.express.val.run?name=Steve
export async function expressHTMLExample(
req: express.Request,
res: express.Response,
const name = req.query.name || req.body.name;
if (!name) return res.json({ error: "must specify ?name or POST similar as JSON" });
const json = { hi: { foo: name } };
return res.json(json);
tmcw avatar
generateRAdioDjRss
@tmcw
An interactive, runnable TypeScript val by tmcw
HTTP
export const generateRAdioDjRss = async () => {
const rssItems = previousDjs.map((dj) => {
const djImgSrc = `https://r-a-d.io/api/dj-image/${
encodeURIComponent(
dj.djimage,
const djMessage = dj.djtext === "" || dj.djtext === "x"
: `${dj.djname} says: ${dj.djtext}`
const threadMessage = dj.thread === "" || dj.thread === "none"
: `Thread link: [${escapeXml(dj.thread)}]`
return {
mauforonda avatar
hiHello
@mauforonda
An interactive, runnable TypeScript val by mauforonda
Script
export let hiHello = (req, res) => {
console.email(req.body.message, `message from ${req.body.page}`);
dupontgu avatar
heavenlyOrangeMarmoset
@dupontgu
An interactive, runnable TypeScript val by dupontgu
Script
export async function blueskyPostWithImage(statusText: string, imageBuffer: any, altText: string) {
const BSKY_EMAIL = Deno.env.get("BSKY_EMAIL");
const BSKY_PWD = Deno.env.get("BSKY_PWD");
const agent = new BskyAgent({service: 'https://bsky.social'})
const loginResult = await agent.login({ identifier: BSKY_EMAIL!, password: BSKY_PWD!})
const rt = new RichText({ text: statusText })
await rt.detectFacets(agent)
const { data } = await agent.uploadBlob(imageBuffer, { encoding: "png" })
const postReuslt = await agent.post({
text: rt.text,
neverstew avatar
discordEventReceiver
@neverstew
An interactive, runnable TypeScript val by neverstew
HTTP
export default async function handler(req: Request) {
console.log(await req.json());
return Response.json({ ok: true });
vladimyr avatar
accepts_example
@vladimyr
// @see: https://github.com/jshttp/accepts#simple-type-negotiation
HTTP
// @see: https://github.com/jshttp/accepts#simple-type-negotiation
export default async function(req: Request): Promise<Response> {
const accept = accepts(req);
const headers = new Headers();
// the order of this list is significant; should be server preferred order
switch (accept.types("json", "html")) {
case "json":
return Response.json({ hello: "world" });
case "html":
headers.set("content-type", "text/html");
cool avatar
tanBoa
@cool
An interactive, runnable TypeScript val by cool
Script
import { createFetch } from "npm:ofetch";
const ofetch = createFetch({ fetch });
const ip = await ofetch("https://httpbun.com/ip.json");
console.log(ip);
console.log();
const ofetch = createFetch({ fetch: fetch_ });
const ip = await ofetch("https://httpbun.com/ip.json");
console.log(ip);
const wip = await ofetch("https://httpbun.com/ip.json");
console.log(wip);
charlypoly avatar
exampleTopHackerNewsDailyEmail
@charlypoly
An interactive, runnable TypeScript val by charlypoly
Cron
export default async function(interval: Interval) {
let html = await loadPageContent("https://news.ycombinator.com/", { textContent: false });
html = html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, ""); // remove useless context
// Then, we define the shape of the data to extract
// with a `zod` schema
const schema = z.object({
top: z
.array(
z.object({
title: z.string(),
nbbaier avatar
dbToApiHelpers
@nbbaier
Helper functions/types for Val Town JSON Server
Script
Helper functions/types for [Val Town JSON Server](https://www.val.town/v/nbbaier/dbToAPI)
export interface Options {
homepage?: FC;
routes?: Record<string, string>;
export const getResources = (db) => {
return Object.entries(db.data).map(([name, value]) => {
const type = Array.isArray(value) ? "plural" : "singular";
const label = type === "singular" ? "object" : `${(value as Array<any>).length}x`;
return { name, type, label };
export const validate = (db) => {
radarthreat avatar
scrapeFargoGolf
@radarthreat
An interactive, runnable TypeScript val by radarthreat
Script
const FARGO_GOLF_URL = "https://foreupsoftware.com/index.php/booking/a/19956/18#/teetimes";
function normalizeURL(url: string) {
return url.startsWith("http://") || url.startsWith("https://")
? url
: "http://" + url;
async function fetchText(url: string, options?: any) {
const response = await fetch(normalizeURL(url), {
redirect: "follow",
...(options || {}),
return response.text();
lbergenmm avatar
hookTest
@lbergenmm
An interactive, runnable TypeScript val by lbergenmm
Script
import { hookJson } from "https://esm.town/v/lbergenmm/hookJson";
let { counter } = await import("https://esm.town/v/lbergenmm/counter");
import { log } from "https://esm.town/v/lbergenmm/log";
export let hookTest = (req: express.Request, res: express.Response) => {
log("start of hookTest. req.body: " + JSON.stringify(req.body));
counter = counter || 0;
counter = counter + 1;
if (req.method === "POST") {
return res.status(200).json(hookJson);
} else {
return res.status(400).json({ message: "nah.. I only know POST" });