Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
web_La1PCylq8q
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_La1PCylq8q(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Cosmic Cheese Eruption Pizza</title>
<style>
body {
font-family: 'Arial', sans-serif;
pfeffunit avatar
iangac_validator
@pfeffunit
IANGAC JSON validator
HTTP
# IANGAC JSON validator
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
function analyzeJSON(jsonData) {
const images = jsonData.images;
const allIds = new Set(images.map(img => img.id));
const referencedIds = new Set();
const errors = [];
const warnings = [];
// Check all references and track referenced IDs
ryoid avatar
chat
@ryoid
An interactive, runnable TypeScript val by ryoid
Script
export let chat = (async () => {
const data = 123;
return data;
stevekrouse avatar
open_in_valtown
@stevekrouse
* @param handler Fetch handler
Script
* @param handler Fetch handler
export default function openInValTown(
handler: (req: Request) => Promise<Response>,
): (req: Request) => Promise<Response> {
const { userHandle, valName } = parentReference();
return async (req: Request): Promise<Response> => {
const res = await handler(req);
if (res.headers.get("Content-Type") !== "text/html") {
return res;
// TODO: Use shadow dom
dhvanil avatar
val_FASG6Vrgm2
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_FASG6Vrgm2(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Create a pixel art cat inspired by the pixel art shown in the reference image
const pixelKitty = `
return pixelKitty;
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
dhvanil avatar
val_9dy3yd3x6A
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_9dy3yd3x6A(req) {
try {
// Ensure request body is consumed
const body = await req.text();
// Create a function from the provided code and execute it
const userFunction = async () => {
const findPrimes = (n) => {
const primes = [];
for (let i = 2; i < n; i++) {
let isPrime = true;
iamseeley avatar
UserWidgets
@iamseeley
@jsxImportSource https://esm.sh/hono@latest/jsx
Script
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
interface UserWidgetsProps {
user: {
currentlyListening?: string;
currentlyReading?: {
title?: string;
author?: string;
coverImage?: string;
currentlyWatching?: {
title?: string;
dhvanil avatar
val_ZNN6EfQkoJ
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_ZNN6EfQkoJ(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const checkRandomness = (numSamples) => { const results = { even: 0, odd: 0 }; for (let i = 0; i < numSamples; i+
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
void avatar
violetKoala
@void
An interactive, runnable TypeScript val by void
HTTP
async function fetchWeather() {
const API_KEY = "439d4b804bc8187953eb36d2a8c26a02"; // Example key, replace with your own
const LAT = 51.5074; // London latitude
const LON = -0.1278; // London longitude
const url =
`https://api.openweathermap.org/data/2.5/onecall?lat=${LAT}&lon=${LON}&exclude=hourly,daily&units=metric&appid=${API_KEY}
console.log("Fetching weather from URL:", url); // Log the full URL
try {
const response = await fetch(url);
if (!response.ok) {
stevekrouse avatar
formOld
@stevekrouse
// Forked from @andreterron.valtown_forms_test
Script
import { html } from "https://esm.town/v/stevekrouse/html";
export const formOld = async (req: Request) => {
const formEndpoint = "https://andreterron-valtown_forms.web.val.run";
return html(`
<form
action="${formEndpoint}"
method="post">
<input name="test" placeholder="test" />
</form>`);
// Forked from @andreterron.valtown_forms_test
janpaul123 avatar
valle_tmp_89429840600482986700048825640037
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
export default async function main(req: Request): Promise<Response> {
const html = `
<!DOCTYPE html>
<html lang="en">
<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>Hello World</title>
</head>
chet avatar
HtmlFormatter
@chet
An interactive, runnable TypeScript val by chet
HTTP
const title = "HTML Formatter";
const html = (url: string) => `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title}</title>
<style>
body {
stevekrouse avatar
expressHTMLExample2
@stevekrouse
// View at https://stevekrouse-expressHTMLExample2.express.val.run?name=Steve
Express (deprecated)
// View at https://stevekrouse-expressHTMLExample2.express.val.run?name=Steve
export async function expressHTMLExample2(
req: express.Request,
res: express.Response,
return res.send(`<h1>Hi ${req.query.name}!</h1>`);
pomdtr avatar
indieauth_server
@pomdtr
@jsxImportSource npm:hono/jsx
HTTP
/** @jsxImportSource npm:hono/jsx **/
const app = new Hono();
const self = extractValInfo(import.meta.url);
app.get("/", (c) => {
return c.html(
<html>
<head>
<link rel="authorization_endpoint" href={self.httpEndpoint} />
</head>
</html>,
iamseeley avatar
UserLinks
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
/** @jsx jsx */
/** @jsxFrag Fragment */
export default function UserLinks({ username, links }) {
return (
<div className="flex flex-row gap-2 flex-wrap sortable">
{links.map((link, index) => (
<div key={index} className="">
{/* Trigger the modal when clicking the link label */}
<div
hx-get={`/edit-link-modal/${username}/${link.id}`}