Search

Results include substring matches and semantically similar vals. Learn more
stevekrouse avatar
push
@stevekrouse
@jsxImportSource npm:hono@3/jsx
HTTP (deprecated)
/** @jsxImportSource npm:hono@3/jsx */
// TODO: in an upcoming version of deno, you can also use npm:web-push which is much more popular
// by just using pushSendNotification
// .svg required for manifest, fav.farm doesn't seem to mind
const iconURL = "https://fav.farm/%F0%9F%94%94.svg";
const app = new Hono();
const vapidDetails = {
url: thisWebURL(),
pubKey: Deno.env.get("qushVapidPublicKey"),
privKey: Deno.env.get("qushVapidPrivateKey"),
cofsana avatar
multirouteHono
@cofsana
🌐 Multi-Route Website with Hono
HTTP (deprecated)
🌐 Multi-Route Website with Hono
* This val creates a simple website for Janic Business Group, a business consulting firm.
* It uses React for the frontend and Hono for the backend routing.
* The website includes a home page, about page, and services page.
/** @jsxImportSource https://esm.sh/react */
const app = new Hono();
function App() {
const [page, setPage] = React.useState('home');
const renderPage = () => {
switch(page) {
u avatar
site
@u
An interactive, runnable TypeScript val by u
Script
export let site = (req: express.Request, res: express.Response) => {
res.set("Content-Type", "text/html");
res.send(`<!DOCTYPE html>
<html lang="en" class="sl-theme-dark">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
nicoalbanese avatar
tomatoMinnow
@nicoalbanese
Vercel AI SDK with Val Town! Use the Vercel AI SDK in your Vals. Note : you must add your OpenAI key to your Val Town Env variables under OPENAI_API_KEY . If you would like to specify a different name for your API Key, you can create a custom OpenAI provider with the createOpenAI function. Prefer another AI provider? Use any supported provider by changing just two lines of code!
HTTP (deprecated)
# Vercel AI SDK with Val Town!
Use the Vercel AI SDK in your Vals.
**Note**: you must add your OpenAI key to your Val Town [Env variables](https://www.val.town/settings/environment-variables)
Prefer another AI provider? Use [any supported provider](https://sdk.vercel.ai/providers/ai-sdk-providers) by changing just t
import { StreamingTextResponse, streamText } from "npm:ai";
export default async function(req: Request): Promise<Response> {
const result = await streamText({
model: openai("gpt-4o"),
prompt: "Generate a fast recipe for Lasagna.",
return result.toTextStreamResponse({ headers: { "Content-Type": "text/event-stream" } });
movienerd avatar
clicker
@movienerd
This is a simple idle clicker game written almost entirely by AI and directed by prompts.
HTTP
This is a simple idle clicker game written almost entirely by AI and directed by prompts.
* This code creates a Money Clicker Game using React for the UI.
* It uses localStorage for client-side persistence and setInterval for auto-upgrades.
* The game features a pixelated, retro-inspired design reminiscent of early computer games.
* It includes various upgrades, including factories, workers, and drones.
* The maximum number of workers and drones is limited to 12 times the number of factories owned.
* "Fire Worker" and "Fire Drone" buttons are included to reduce the number of workers and drones.
* The money calculation prevents the balance from dropping below 0.
* Work is only increased if there is enough money to pay the workers and drones.
* An "Auto-clicker auto-buyer" upgrade is included in the Factory tab.
jdan avatar
emojiWeb
@jdan
https://jdan-emojiweb.web.val.run/alias/flag_jordan
HTTP (deprecated)
https://jdan-emojiweb.web.val.run/alias/flag_jordan
export const emojiWeb = async (req: Request) => {
const { Hono } = await import("npm:hono");
const app = new Hono();
app.get("/", (c) => {
const toc = `<ul>
Object.keys(emojiByGroup).map((group) =>
`<li><a href="#${group}">${group}</a></li>`
).join("")
</ul>`;
janpaul123 avatar
valle_tmp_821221338019192827080648147114728
@janpaul123
// This HTTP val will generate an HTML frontend for a simple Hacker News clone.
HTTP (deprecated)
// This HTTP val will generate an HTML frontend for a simple Hacker News clone.
// It will use hardcoded example stories for now and display them in a clean layout.
const app = new Hono();
const exampleStories = [
title: "Introducing Val Town",
url: "https://val.town",
points: 100,
author: "Steve Krouse",
comments: 30,
title: "Hacker News Clone with Val Town",
vladimyr avatar
ittyRouterExample
@vladimyr
An interactive, runnable TypeScript val by vladimyr
HTTP (deprecated)
import { AutoRouter } from "npm:itty-router@5";
const router = AutoRouter();
router.get("/", () => "Hi from itty-router!");
export default denoServer(router.fetch);
nukeop avatar
fourchan_catalog
@nukeop
An interactive, runnable TypeScript val by nukeop
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const fourchan_catalog = (board: string) =>
fetchJSON(`https://a.4cdn.org/${board}/catalog.json`);
stevekrouse avatar
likelyCyanPartridge
@stevekrouse
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
HTTP (deprecated)
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
/** @jsxImportSource https://esm.sh/react */
const valTownToken = Deno.env.get("valtown");
const vt = new ValTown({ bearerToken: valTownToken });
const app = new Hono();
const jsxResponse = (jsx) => {
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
const username = extractValInfo(import.meta.url).author;
const systemprompt = await fetchText(
"https://gist.githubusercontent.com/stevekrouse/21cba8759c09f906be424dc1bb949869/raw/townie.md",
pomdtr avatar
heynote
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP (deprecated)
import { handler } from "jsr:@pomdtr/val-town-heynote@0.1.1";
export default handler;
neverstew avatar
testAssert
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
export const testAssert = (async () => {
const { assert } = await import(
"https://deno.land/std@0.196.0/testing/asserts.ts"
assert(false, "Failed");
spolu avatar
test1
@spolu
An interactive, runnable TypeScript val by spolu
Script
export let test1 = async () => {
console.log("HEY");
nbbaier avatar
tanaTypes
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
export type APIDataType = "boolean" | "plain" | "date" | "url" | "reference";
export type NodeType = "node" | undefined;
export type CommonNodeProps = {
dataType?: APIDataType;
type?: NodeType;
export type APICheckboxNode = {
value: boolean;
} & CommonNodeProps;
export type APIDateNode = {
name: string;
pomdtr avatar
openapi2TS
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { prettifyTS } from "https://esm.town/v/pomdtr/prettifyTS";
export async function openapi2TS(url: string) {
const yaml = await import("npm:yaml");
const resp = await fetch(url);
const spec = yaml.parse(await resp.text());
return prettifyTS(
`export default ${JSON.stringify(spec)} as const;`,