Search
val_DDlHRsQXxj
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_DDlHRsQXxj(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const generateSeededRandomSequence = (seed, length) => {
const sequence = [];
let currentSeed = seed;
for (let i = 0; i < length; i++) {
currentSeed = (currentSeed * 9301 + 49297) % 233280;
sequence.push(currentSeed / 233280);
satisfiedPurpleHyena
@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 </body>\n </html>\n"`, {
headers: {
"Content-Type": "text/html",
val_1mTgERX3iy
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
return 100;
return Response.json({ success: true, result });
} catch (error) {
return Response.json({
success: false,
error: error.message
}, { status: 500 });
codemirror_web_component
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
const html = `
<html>
<head>
<style>body { margin: 0px }</style>
<script type="module" src="https://cdn.jsdelivr.net/gh/vanillawc/wc-codemirror@1/index.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/vanillawc/wc-codemirror@1/mode/javascript/javascript.js"></script>
</head>
<body>
<wc-codemirror mode="javascript">
<script type="wc-content" >
amberPig
@tempguy
An interactive, runnable TypeScript val by tempguy
Script
const nanoid = customAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 10);
const baseUrl = "https://d000d.com";
export async function doodstream(ctx: Context) {
let url = ctx.url;
if (ctx.url.includes("primewire")) {
const request = await fetch(ctx.url);
const id = url.split("/d/")[1] || url.split("/e/")[1];
const doodDataReq = await fetch(
`https://structural-sidonia-supergalaxy-4284f8da.koyeb.app/hdiuhmalkmc9d0ck7UCFVGBJHN?destination=`
+ encodeURIComponent(`${baseUrl}/e/${id}`),
vttThumbMaker
@g
Val Town Town: Thumbnail Maker Live on VTT! This is a port of my
Thumbnail Maker val
for the
Val Town Town Runtime
by @maxm
build on top of
val.town . Limitations: On Val Town Town, your application lives on a single route.
This means serving multiple assets (main.js, styles.css) does not work the traditional way.
In this example, I use a ?f= query parameter to work around this limitation. Updates to this val are not instantly applied because of caching.
Script
# Val Town Town: Thumbnail Maker
[Live on VTT!](https://maxm-valtowntown.web.val.run/handler/116)
This is a port of my
[Thumbnail Maker val](https://www.val.town/v/g/ThumbMaker)
for the
[Val Town Town Runtime](https://www.val.town/v/maxm/valtowntown)
// Val Town Town implementation of Thumb Maker
const app = new Hono();
const r404 = () => new Response('[116] 404 not found', { status: 404 });
app.get('/serve/116', (c) => {
whatsThatAgainInHotDogs
@dthyresson
A Townie remake of https://www.val.town/v/dthyresson/whatsThatInHotDogs
HTTP
A Townie remake of https://www.val.town/v/dthyresson/whatsThatInHotDogs
const app = new Hono()
const players = [
{ name: "Max Scherzer", team: "New York Mets", stadium: "Citi Field", salary: 43333333, hotdogPrice: 7.00 },
{ name: "Mike Trout", team: "Los Angeles Angels", stadium: "Angel Stadium", salary: 37116666, hotdogPrice: 6.50 },
{ name: "Anthony Rendon", team: "Los Angeles Angels", stadium: "Angel Stadium", salary: 36571429, hotdogPrice: 6.50 },
{ name: "Gerrit Cole", team: "New York Yankees", stadium: "Yankee Stadium", salary: 36000000, hotdogPrice: 6.00 },
{ name: "Nolan Arenado", team: "St. Louis Cardinals", stadium: "Busch Stadium", salary: 35000000, hotdogPrice: 5.75 },
{ name: "Stephen Strasburg", team: "Washington Nationals", stadium: "Nationals Park", salary: 35000000, hotdogPrice: 6.25 },
{ name: "Francisco Lindor", team: "New York Mets", stadium: "Citi Field", salary: 34100000, hotdogPrice: 7.00 },
html
@hussseinkizz
// let message = html`<p onclick="() => console.log('hola')">some ${user}</p>`;
Script
export function html(strings, ...values) {
let result = '';
strings.forEach((string, i) => {
result += string + (values[i] || '');
return result;
const data = {
todoItem: {
completed: true,
task: 'Sample Task',
id: 1,
wasmToDTS
@just_be
An interactive, runnable TypeScript val by just_be
HTTP
import {
generate_dts,
initSync,
} from "https://just_be-gh_releases.web.val.run/zephraph/wasm-to-dts/v10/wasm_to_dts_bg.wasm";
initSync(WasmModule);
export default async function(req: Request): Promise<Response> {
if (req.method === "POST") {
const result = generate_dts(new Uint8Array(await req.arrayBuffer()));
console.log("result");
return Response.json({ ok: true });
web_pknUV9YbLu
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_pknUV9YbLu(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
<style>
body { font-family: sans-serif; margin: 2rem; }
</style>
test_explorer_router
@pomdtr
@jsxImportSource npm:hono/jsx
Script
/** @jsxImportSource npm:hono/jsx */
createHistory,
type HistoryEntry,
readHistory,
writeHistory,
} from "https://esm.town/v/pomdtr/test_explorer_history";
const router = new Hono();
const { author } = extractValInfo(import.meta.url);
router.get("/", async (c) => {
try {
limeBadger
@tmcw
@jsxImportSource npm:hono@3/jsx
HTTP
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
app.get("/", async (c) => {
const response = await fetch("https://hacker-news.firebaseio.com/v0/topstories.json");
const storyIds = await response.json();
const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${storyIds[0]}.json`);
const story = await storyResponse.json();
return c.html(
<div>
<h1>{story.title}</h1>
LoginModal
@iamseeley
@jsxImportSource https://esm.sh/hono@latest/jsx
Script
/** @jsxImportSource https://esm.sh/hono@latest/jsx */
export default function LoginModal() {
return (
<div id="login-modal" className="z-100 fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 animate-fadeIn">
<div className="bg-white rounded-lg shadow-xl p-8 w-full max-w-md mx-4 mt-4 mb-0">
<div className="flex flex-col gap-1 mb-4">
<h2 className="text-xl font-bold ">Login to Your Profile</h2>
<p className="text-sm text-neutral-800">
No account?{' '}
<a
val_YI2jnzJKfc
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_YI2jnzJKfc(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const square = (x) => x * x; return square(9);
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
purpleHornet
@stevekrouse
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
export const Bringing_My_OCD_Online = (c: Context) => {
return c.html(
<html>
<head>
<title>Bringing My OCD Online</title>
<style
dangerouslySetInnerHTML={{
__html:
`:root{--slate1: hsl(200, 7%, 8.8%);--slate2: hsl(195, 7.1%, 11%);--slate3: hsl(197, 6.8%, 13.6%);--slate4: hsl(198, 6.6%, 15.8%);--slate5: hsl(199, 6.4%, 17.9%);--slate6: hsl(201, 6.2%, 20.5%);--slate7: hsl(203, 6%, 24.3%);--slate8: hsl(207, 5.6%, 31.6%);--slate9: hsl(206, 6%, 43.9%);--slate10: hsl(206, 5.2%, 49.5%);--slate11: hsl(206, 6%, 63%);--slate12: hsl(210, 6%, 93%);--blue1: hsl(212, 35%, 9.2%);--blue2: hsl(216, 50%, 11.8%);--blue3: hsl(214, 59.4%, 15.3%);--blue4: hsl(214, 65.8%, 17.9%);--blue5: hsl(213, 71.2%, 20.2%);--blue6: hsl(212, 77.4%, 23.1%);--blue7: hsl(211, 85.1%, 27.4%);--blue8: hsl(211, 89.7%, 34.1%);--blue9: hsl(206, 100%, 50%);--blue10: hsl(209, 100%, 60.6%);--blue11: hsl(210, 100%, 66.1%);--blue12: hsl(206, 98%, 95.8%)}body{font-family:system-ui,sans-serif;margin:auto;padding:20px;max-width:65ch;text-align:left;word-wrap:break-word;overflow-wrap:break-word;line-height:1.5}h1,h2,h3,h4,h5,h6,strong,b{font-weight:500}a{color:var(--blue10)}nav a{margin-right:10px}textarea{width:100%;font-size:16px}input{font-size:16px}content{line-height:1.6}table{width:100%}img{max-width:100%;height:auto}code{padding:2px 5px;background-color:var(--slate4);font-family:menlo,monospace}pre{padding:1rem}pre>code{all:unset}blockquote{border:1px solid var(--slate10);color:var(--slate11);padding:2px 0 2px 20px;margin:0;font-style:italic}`,