Search
scarletSole
@temptemp
An interactive, runnable TypeScript val by temptemp
HTTP
interface Context {
url: string;
const app = new Hono();
app.get("/dood/:dood", async (c) => {
const { dood } = c.req.param();
const ctx = { url: "https://d000d.com/e/" + dood };
return c.json(await doodstream(ctx));
app.get("/tape/:tape", async (c) => {
const { tape } = c.req.param();
const ctx = { url: "https://streamtape.com/e/" + tape };
cerebrascoderWebApp
@ashokpds15
An interactive, runnable TypeScript val by ashokpds15
HTTP
export default async function server(request: Request): Promise<Response> {
return new Response(`
<!DOCTYPE html>
<html>
<head>
<title>Cerebrascoder</title>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" href="https://esm.sh/bootstrap@4.0.0/dist/css/bootstrap.min.css">
<style>
lucia_demo
@pomdtr
@jsxImportSource npm:hono/jsx
HTTP
/** @jsxImportSource npm:hono/jsx **/
const userTable = "user";
const sessionTable = "session";
const adapter = new ValTownAdapter({
user: "user",
session: "session",
export const lucia = new Lucia(adapter, {
getUserAttributes: (attributes) => {
return {
username: attributes.username,
web_mBvDDUywvr
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_mBvDDUywvr(req) {
return new Response(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Awesome Website</title>
<style>
body {
font-family: 'Arial', sans-serif;
web_QGLg8dmk1o
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_QGLg8dmk1o(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Little Website</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; background-color: #f4f4f4; }
h1 { color: #333; }
dateme_home
@stevekrouse
@jsxImportSource npm:hono@3/jsx
Script
/** @jsxImportSource npm:hono@3/jsx */
export default function Home(c) {
return c.html(
<Layout activeTab={new URL(c.req.url).pathname}>
<div class="max-w-lg mx-auto p-10">
<div class="mb-10">
<div class="text-4xl font-bold mb-4">
Date thoughtfully
</div>
<div class="text-lg ">
compassionateBlackCatfish
@gigmx
// Add a separate API route handler for chat
HTTP
export default async function(req: Request): Promise<Response> {
const LEPTON_API_TOKEN = Deno.env.get('LEPTON_API_TOKEN') || '';
return new Response(
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quantum AI Interface</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2/dist/tailwind.min.css" rel="stylesheet">
bbrun
@yejun
A simple chat app harness for your board Provides a very simple chat app UI for a Breadboard board. For now, requires you to be running a board server. This harness actually acts
as a proxy to the board server run API endpoint ,
and puts a nice (well, somewhat nice) frontend on top of it. The frontend is somewhat limited in what it can show, currently supporting only
LLMContent and array of LLMContent outputs, and only LLMContent array input. The script will look for the BB_LIVE_KEY in your Val Town environment, which
must contain your board server API key. To use, create an HTTP val, then import the proxy function from this script and call it like this:
import { proxy } from "https://esm.town/v/dglazkov/bbrun";
export default proxy(
"url-to-the-board.bgl.json",
);
Script
# A simple chat app harness for your board
Provides a very simple chat app UI for a [Breadboard](https://breadboard-ai.web.app/) board.
For now, requires you to be running a board server. This harness actually acts
as a proxy to the board server [run API endpoint](https://breadboard-ai.github.io/breadboard/docs/reference/board-run-api-endpoint/),
and puts a nice (well, somewhat nice) frontend on top of it.
The frontend is somewhat limited in what it can show, currently supporting only
const DEFAULT_FRONTEND_MODULE = "https://esm.town/v/yejun/bbrun";
* You can supply these options as a second argument to the `proxy` function.
* These options are used to configure the frontend.
export type FrontendOptions = {
graffitiWebsite
@andreterron
// Forked from @andreterron.genval
HTTP
export let graffitiWebsite = async (req: express.Request, res: express.Response) => {
const { default: htm } = await import("npm:htm");
const { default: vhtml } = await import("npm:vhtml");
const html = htm.bind(vhtml);
const head = html`<head>
<title>Graffiti Wall</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
publicDocumentEditor
@tr3ntg
An interactive, runnable TypeScript val by tr3ntg
Script
export async function publicDocumentEditor(
req: express.Request,
res: express.Response,
let html =
`<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Editor.js ๐คฉ๐งฆ๐คจ example</title> <link href="https://fonts.googleapis.com/css?family=PT+Mono" rel="stylesheet"> <link href="../public/assets/demo.css" rel="stylesheet"> <script src="../public/assets/json-preview.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /></head><body> <div class="ce-example"> <div class="ce-example__header"> <a class="ce-example__header-logo" href="https://codex.so/editor">Editor.js ๐คฉ๐งฆ๐คจ</a> <div class="ce-example__header-menu"> <a href="https://github.com/editor-js" target="_blank">Plugins</a> <a href="https://editorjs.io/usage" target="_blank">Usage</a> <a href="https://editorjs.io/configuration" target="_blank">Configuration</a> <a href="https://editorjs.io/creating-a-block-tool" target="_blank">API</a> </div> </div> <div class="ce-example__content _ce-example__content--small"> <div id="editorjs"></div> <div class="ce-example__button" id="saveButton"> editor.save() </div> <div class="ce-example__statusbar"> Readonly: <b id="readonly-state"> Off </b> <div class="ce-example__statusbar-button" id="toggleReadOnlyButton"> toggle </div> </div> </div> <div class="ce-example__output"> <pre class="ce-example__output-content" id="output"></pre> <div class="ce-example__output-footer"> <a href="https://codex.so" style="font-weight: bold;">Made by CodeX</a> </div> </div> </div> <!-- Load Tools --> <!-- You can upload Tools to your project's directory and connect them by relative links. Also you can load each Tool from CDN or use NPM/Yarn packages. Read more at Tools Connection doc: https://editorjs.io/getting-started#tools-connection --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script><!-- Header --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script><!-- Image --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/delimiter@latest"></script><!-- Delimiter --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/list@latest"></script><!-- List --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/checklist@latest"></script><!-- Checklist --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/quote@latest"></script><!-- Quote --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/code@latest"></script><!-- Code --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/embed@latest"></script><!-- Embed --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/table@latest"></script><!-- Table --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/link@latest"></script><!-- Link --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/warning@latest"></script><!-- Warning --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"></script><!-- Marker --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest"></script><!-- Inline Code --> <!-- Load Editor.js's Core --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script><script>var editor=new EditorJS({readOnly:!1,holder:'editorjs',tools:{header:{class:Header,inlineToolbar:['marker','link'],config:{placeholder:'Header'},shortcut:'CMD+SHIFT+H'},image:SimpleImage,list:{class:List,inlineToolbar:!0,shortcut:'CMD+SHIFT+L'},checklist:{class:Checklist,inlineToolbar:!0,},quote:{class:Quote,inlineToolbar:!0,config:{quotePlaceholder:'Enter a quote',captionPlaceholder:'Quote\'s author',},shortcut:'CMD+SHIFT+O'},warning:Warning,marker:{class:Marker,shortcut:'CMD+SHIFT+M'},code:{class:CodeTool,shortcut:'CMD+SHIFT+C'},delimiter:Delimiter,inlineCode:{class:InlineCode,shortcut:'CMD+SHIFT+C'},linkTool:LinkTool,embed:Embed,table:{class:Table,inlineToolbar:!0,shortcut:'CMD+ALT+T'},},data:{},onReady:function(){saveButton.click()},onChange:function(api,event){console.log('something changed',event)}});const saveButton=document.getElementById('saveButton');const toggleReadOnlyButton=document.getElementById('toggleReadOnlyButton');const readOnlyIndicator=document.getElementById('readonly-state');saveButton.addEventListener('click',function(){editor.save().then((savedData)=>{cPreview.show(savedData,document.getElementById("output"))}).catch((error)=>{console.error('Saving error',error)})});toggleReadOnlyButton.addEventListener('click',async()=>{const readOnlyState=await editor.readOnly.toggle();readOnlyIndicator.textContent=readOnlyState?'On':'Off'})</script></body></html>`;
res.send(html);
web_vUijVegdsR
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_vUijVegdsR(req) {
return new Response(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๐งโโ๏ธ Unhinged Mermaid Diagram Extravaganza ๐</title>
<style>
body {
font-family: 'Comic Sans MS', cursive;
SubmitLogin
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
/** @jsx jsx */
/** @jsxFrag Fragment */
const SubmitLogin = async (c) => {
try {
const body = await c.req.parseBody();
const username = body["username"];
const password = body["password"];
const checkUser = await sqlite.execute({
sql: `SELECT * FROM users WHERE username = ?`,
args: [username],
claude_d482d9ee_eff3_42e6_9779_a012b1e1f7b4
@adagradschool
An interactive, runnable TypeScript val by adagradschool
HTTP
export default function handler(req) {
return new Response(`"\n <!DOCTYPE html>\n <html>\n <head>\n <title>Claude Chat Conversation</title>\n <meta charset=\"UTF-8\">\n <style>\n body {\n font-family: system-ui, -apple-system, sans-serif;\n line-height: 1.5;\n max-width: 800px;\n margin: 0 auto;\n padding: 20px;\n background: #f9fafb;\n }\n .message {\n margin: 20px 0;\n padding: 15px;\n border-radius: 8px;\n }\n .human {\n background: #e5e7eb;\n }\n .assistant {\n background: #dbeafe;\n }\n .role {\n font-weight: bold;\n margin-bottom: 8px;\n }\n </style>\n </head>\n <body>\n \n <div class=\"message human\">\n <div class=\"role\">Human</div>\n <div class=\"content\">so, how was your day</div>\n </div>\n \n <div class=\"message assistant\">\n <div class=\"role\">Claude</div>\n <div class=\"content\">I aim to have authentic conversations while being direct about my nature as an AI. While I appreciate the friendly question, I should note that I don't actually experience days in the way humans do. I'd be happy to hear about your day though, or to help you with any questions or tasks you might have.</div>\n </div>\n \n </body>\n"`, {
headers: {
"Content-Type": "text/html",
val_Rb1F0hdOA9
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_Rb1F0hdOA9(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const visualizeData = (data) => { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); canvas.width = 800; canvas.height = 400; document.body.appendChild(canvas); const maxCount = Math.max(...Object.values(data)); const barWidth = canvas.width / Object.keys(data).length; Object.entries(data).forEach(([num, count], index) => { const barHeight = (count / maxCount) * canvas.height; ctx.fillStyle = 'blue'; ctx.fillRect(index * barWidth, canvas.height - barHeight, barWidth - 1, barHeight); ctx.fillStyle = 'black'; ctx.fillText(num, index * barWidth + barWidth / 2 - 5, canvas.height - barHeight - 5); }); }; visualizeData({"0":98,"1":86,"2":97,"3":97,"4":93,"5":112,"6":93,"7":106,"8":108,"9":89,"10":106,"11":108,"12":87,"13":112,"14":96,"15":93,"16":112,"17":96,"18":97,"19":86,"20":100,"21":102,"22":101,"23":85,"24":95,"25":103,"26":86,"27":92,"28":109,"29":107,"30":95,"31":102,"32":107,"33":92,"34":96,"35":99,"36":100,"37":104,"38":88,"39":115,"40":97,"41":90,"42":113,"43":102,"44":103,"45":92,"46":81,"47":101,"48":98,"49":95,"50":88,"51":92,"52":94,"53":100,"54":107,"55":99,"56":102,"57":96,"58":90,"59":95,"60":106,"61":111,"62":83,"63":109,"64":98,"65":98,"66":108,"67":102,"68":122,"69":102,"70":82,"71":98,"72":109,"73":99,"74":94,"75":94,"76":127,"77":103,"78":93,"79":111,"80":106,"81":98,"82":105,"83":111,"84":106,"85":104,"86":94,"87":102,"88":101,"89":99,"90":101,"91":105,"92":98,"93":121,"94":89,"95":110,"96":103,"97":95,"98":103,"99":115});
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
humansnap
@ngmi
An interactive, runnable TypeScript val by ngmi
HTTP
const KEY = new URL(import.meta.url).pathname.split("/").at(-1);
const ADMIN_PASSWORD = Deno.env.get("ADMIN_PASSWORD") || "defaultpassword"; // Set this in your Val Town environment variables
async function initializeDatabase() {
await sqlite.execute(`
CREATE TABLE IF NOT EXISTS ${KEY}_emails (
id INTEGER PRIMARY KEY AUTOINCREMENT,
email TEXT NOT NULL UNIQUE,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
async function addEmail(email: string) {
await sqlite.execute(`INSERT OR IGNORE INTO ${KEY}_emails (email) VALUES (?)`, [email]);