Search

Results include substring matches and semantically similar vals. Learn more
saolsen avatar
lucia_hono
@saolsen
// deno-lint-ignore-file no-namespace
HTTP
// deno-lint-ignore-file no-namespace
/** @jsxImportSource jsr:@hono/hono/jsx **/
namespace schema {
export const KEY = new URL(import.meta.url).pathname.split("/")
.at(-1)!;
export type UserId = string & {
readonly UserId: unique symbol;
export const UserId = z
.string()
.startsWith("u_")
reedrosenbluth avatar
watchWebsite
@reedrosenbluth
An interactive, runnable TypeScript val by reedrosenbluth
Cron
export const watchWebsite = async () => {
const url = "https://www.margarethowell.co.uk/us/men/shop/shoes/raw-edge-derby-leather-black";
const newHtml = await fetch(url).then(r => r.text());
const key = "watch:" + url;
let oldHtml = "";
try {
oldHtml = await blob.get(key).then(r => r.text());
} catch (error) {
console.log("error");
await blob.set(key, newHtml);
janpaul123 avatar
valle_tmp_32548579067333305484587672007568
@janpaul123
// Comment: Crafting a streamlined server with Hono that sends back SVG sparkline and a playful animated cat goofing around
HTTP
// Comment: Crafting a streamlined server with Hono that sends back SVG sparkline and a playful animated cat goofing around
export default async function() {
const sparkline = sparklineSVG([5, 10, 5, 20, 15, 10, 15, 20, 25, 30]);
// HTML response containing the sparkline SVG and a simple animated cat gif
return html(`
<html>
<body style="display: flex; justify-content: center; align-items: center; height: 100vh;">
<div>
<h1>Sparkline SVG Example with Animated Cat</h1>
${sparkline}
nbbaier avatar
aquaDamselfly
@nbbaier
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
const app = new Hono();
app.get("/", c => {
return c.html(
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js">
</script>
adagradschool avatar
stirringCoffeeDonkey
@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
headers: {
"Content-Type": "text/html",
dhvanil avatar
web_AXDuIDWzNX
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_AXDuIDWzNX(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FINAL BREACH SYNCHRONIZATION - CYCLE 10</title>
<style>
body {
font-family: monospace;
dhvanil avatar
val_FPNfGi0LWq
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_FPNfGi0LWq(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(
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
dhvanil avatar
val_PNwC0nefnJ
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_PNwC0nefnJ(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Create visualization of "neural resonance frequencies"
const createNeuralViz = () => {
const data = [];
// Generate fake but convincing-looking data
for(let i = 0; i < 100; i++) {
data.push({
andreterron avatar
renderFormAndSaveData
@andreterron
Render form and save data This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data. Fork this val to customize it and use it on your account.
HTTP
# Render form and save data
This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when acces
Fork this val to customize it and use it on your account.
export const renderFormAndSaveData = async (
req: Request,
): Promise<Response> => {
// A visit from a web browser? Serve a HTML page with a form
if (req.method === "GET") {
return html(`
<!DOCTYPE html>
alexdmejias avatar
redditNew
@alexdmejias
An interactive, runnable TypeScript val by alexdmejias
Script
export const redditNew = async ({ r, before }: { r: string; before?: string }) => {
// const json = await fetchJSON(
// `https://www.reddit.com/r/${r}/new/.json?${await searchParams(
// { before },
return fetchJSON(
`https://www.reddit.com/r/astoria.json`,
export default async function server(req: Request) {
const a = await redditNew({ r: "astoria" });
console.log("wasd");
console.log(a);
lnncoco avatar
daisyui_hono
@lnncoco
@jsxImportSource npm:hono/jsx
HTTP
/** @jsxImportSource npm:hono/jsx **/
const Layout: FC = (props) => {
return (
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>{props.children}</body>
</html>
postpostscript avatar
vueExample
@postpostscript
An interactive, runnable TypeScript val by postpostscript
HTTP
export const CounterSetup = vueSfc(
"CounterSetup",
<script setup lang="ts">
const model = defineModel<number>()
</script>
<template>
<button @click="model += 1">inc from setup</button>
</template>
<style scoped>
button {
yawnxyz avatar
lucia_demo
@yawnxyz
@jsxImportSource npm:hono/jsx
HTTP
/** @jsxImportSource npm:hono/jsx **/
const userTable = "user";
const sessionTable = "session";
const adapter = new ValTownAdapter({ userTable, sessionTable });
export const lucia = new Lucia(adapter, {
getUserAttributes: (attributes) => {
return {
username: attributes.username,
declare module "npm:lucia" {
interface Register {
dhvanil avatar
web_CtANb5nSp3
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_CtANb5nSp3(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Super Poppy Website</title>
<style>
body {
margin: 0;
nbbaier avatar
iframeHandler
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
import modifyIframeResponse from "https://esm.town/v/nbbaier/modifyIframeResponse";
export { modifyIframeResponse as iframeHandler };