Search
openAiExample
@yawnxyz
// Server-side rendering
HTTP (deprecated)
/** @jsx jsx */
const app = new Hono();
const openai = new OpenAI();
app.use('*', cors({
origin: '*',
allowMethods: ['GET', 'POST'],
allowHeaders: ['Content-Type'],
// Server-side rendering
app.get("/", async (c) => {
const html = (
hono
@huangyuzhang
An interactive, runnable TypeScript val by huangyuzhang
HTTP (deprecated)
import { Hono } from "npm:hono@4";
const app = new Hono();
app.get("/", (c) => c.text("Hello Val!"));
export default app.fetch;
foo
@tmm
An interactive, runnable TypeScript val by tmm
Script
export async function foo() {
const { createPublicClient, http } = await import("npm:viem");
const { mainnet } = await import("npm:viem/chains");
const client = createPublicClient({
chain: mainnet,
transport: http(),
console.log(client);
import
@dvdsgl_old
An interactive, runnable TypeScript val by dvdsgl_old
Script
export let import = async name => {
return await import(\`https://cdn.skypack.dev/\${name}\`);
chai
@karfau
// @deno-types="https://unpkg.com/@types/chai/index.d.ts"
Script
// @deno-types="https://unpkg.com/@types/chai/index.d.ts"
// found @ https://github.com/denoland/deno_std/issues/1284#issuecomment-932611198
const {
assert,
Assertion,
AssertionError,
config,
expect,
use,
util,
nestedVal
@iamseeley
@jsxImportSource npm:hono@3/jsx
HTTP (deprecated)
/** @jsxImportSource npm:hono@3/jsx */
import { Hono } from "npm:hono";
const app = new Hono();
app.get("/", async (c) => {
return c.html(
<div>
<iframe width="100%" height="400px" src="https://www.val.town/embed/iamseeley/spinner" title="Val Town" frameborder="0" allow="web-share" allowfullscreen></iframe>
</div>
export default app.fetch;
nighthawksChat
@yawnxyz
It's Late. Get a drink. Have a chat.
Welcome to Nighthawks. Nighthawks is an experiment in building interesting NPC characters with AI. The system combines large language models, simulates conversations using character sheets, and attempts to build memories based on the conversation. Improvise, have fun. Approach them like you would at a late night diner. Inspired by the Nighthawks painting. Built on a stripped down agent-based memory system.
HTTP (deprecated)
It's Late. Get a drink. Have a chat.
Welcome to Nighthawks.
Nighthawks is an experiment in building interesting NPC characters with AI. The system combines large language models, simulates conversations using character sheets, and attempts to build memories based on the conversation.
Improvise, have fun. Approach them like you would at a late night diner.
Inspired by the Nighthawks painting. Built on a stripped down agent-based memory system.
/** @jsx jsx */
const app = new Hono();
const nighthawks = new Nighthawks();
const kv = new KV();
async function generateText(prompt, charId) {
flydotioRSS
@mstubbs
An interactive, runnable TypeScript val by mstubbs
HTTP (deprecated)
export async function flydotioRSS(req: Request): Promise<Response> {
const response = await fetch("https://fly.io/blog/");
const body = await response.text();
const $ = cheerio.load(body);
const feed = new Feed({
title: "Fly.io Blog",
description: "This is my personal feed!",
id: "https://fly.io/blog/",
link: "https://fly.io/blog/",
image: "https://fly.io/static/images/favicon/favicon-32x32.png",
honoExample
@qqyule
An interactive, runnable TypeScript val by qqyule
HTTP (deprecated)
import { Hono } from "npm:hono@3";
const app = new Hono();
app.get("/", (c) => c.text("Hello from Hono!"));
app.get("/yeah", (c) => c.text("Routing!"));
app.post("/json", async (c) => {
const body = await c.req.json();
return c.json(body);
export default app.fetch;
linkInBioTemplate
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
export default async function(req: Request) {
return new Response(
renderToString(
<html>
<head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Joe Schmo</title>
</head>
clerk_hono_poc
@saolsen
Sloppy but it's a working POC. Clerk key would be shared by all vals though, probably annoying since you'd have to configure each URL in clerk. Could be fine though. The CLERK_JWT_KEY is a hack where I took the pem and replaced all the newlines with '|' so I could set it as an env var and then turn them back to newlines.
HTTP (deprecated)
Sloppy but it's a working POC. Clerk key would be shared by all vals though, probably annoying since you'd have to configure each URL in clerk. Could be fine though.
The CLERK_JWT_KEY is a hack where I took the pem and replaced all the newlines with '|' so I could set it as an env var and then turn them back to newlines.
/* @jsxImportSource https://esm.sh/hono/jsx */
const clerk_pub_key = Deno.env.get("CLERK_PUB_KEY");
const clerk_jwt_key = Deno.env.get("CLERK_JWT_KEY").replaceAll("|", "\n");
const jwt_key = await importSPKI(clerk_jwt_key, "RS256");
const app = new Hono();
function main(children: Child): JSX.Element {
return (
<main id="main">
ace
@saolsen
@jsxImportSource npm:hono/jsx
HTTP (deprecated)
/** @jsxImportSource npm:hono/jsx */
export type ContextVars = {};
export type SiteContext = Context<{ Variables: ContextVars }>;
const Body: FC<{ children: Child }> = ({ children }) => {
return (
<body>
<main>{children}</main>
</body>
const Page: FC<{ children: Child }> = ({ children }) => {
return (
tiny_jest_example
@saolsen
An interactive, runnable TypeScript val by saolsen
Script
import { expect, prettify, Test } from "npm:tiny-jest";
const { it, run, title } = new Test("basic");
it("2+2=4", () => {
expect(2 + 2).toBe(4);
it("1+2=4", async () => {
expect(1 + 2).toBe(4);
run().then(prettify);
micromarkTest
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
import { buildLayout } from "https://esm.town/v/nbbaier/buildLayout";
export const micromarkTest = async (
req: express.Request,
res: express.Response
const { micromark } = await import("npm:micromark");
const md = "*emphasis* and **strong**";
res.send(
buildLayout({
body: micromark(md),
// res.send(micromark(md));
dependencyLicenses
@kylem
Dependency License Checker Enter a raw github URL to a package.json, https://raw.githubusercontent.com/username/repo/branch/package.json and get a table of license types for all your dependencies. A fork of gitReleaseNotes
HTTP (deprecated)
# Dependency License Checker
Enter a raw github URL to a package.json,
https://raw.githubusercontent.com/username/repo/branch/package.json
and get a table of license types for all your dependencies.
*A fork of [gitReleaseNotes](https://www.val.town/v/kylem/gitReleaseNotes)*
/** @jsxImportSource npm:hono@3/jsx */
interface PackageJson {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
interface PackageLicense {