Search

Results include substring matches and semantically similar vals. Learn more
baj avatar
browserlessScrapeExample
@baj
// import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
HTTP
// import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const browserlessScrapeExample = (async () => {
try {
const res = await fetch(
`https://chrome.browserless.io/scrape?token=${process.env.browserlessKey}`,
method: "POST",
headers: {
"Cache-Control": "no-cache",
"Content-Type": "application/json",
body: JSON.stringify({
pomdtr avatar
cmdk_command
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
#!/usr/bin/env -S deno serve --allow-all --env --watch
const app = new Hono();
const token = Deno.env.get("valtown");
app.get("/", async (c) => {
const resp = await fetchAPI("/v1/me", {
token,
if (!resp.ok) {
return resp;
const me = await resp.json();
const page = {
jdan avatar
emojiExploder
@jdan
@jsxImportSource npm:hono@3/jsx
HTTP
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
app.get("/", async (c) => {
return c.html(
<div>
<h1>Emoji exploder</h1>
<div>Enter an emoji and see what it's composed of</div>
<form action="/emoji" method="get">
<input type="text" name="emoji" /> <input type="submit" />
</form>
dhvanil avatar
val_rtQZdKLmu1
@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 });
dhvanil avatar
val_3kuijJRJiV
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_3kuijJRJiV(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Create a fun ASCII art of a cat
const catAscii = `
( o o )
return catAscii;
// Return the result in a properly formatted response
return new Response(JSON.stringify({
janpaul123 avatar
valle_tmp_49647457967619054218103114793202
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
export default async function(req: Request): Promise<Response> {
const html = `
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
yawnxyz avatar
perlinNoiseFabric
@yawnxyz
Full credit goes to @yuruyurau: https://twitter.com/yuruyurau/status/1830677030259839352
HTTP
Full credit goes to @yuruyurau: https://twitter.com/yuruyurau/status/1830677030259839352
export default async function (req: Request): Promise<Response> {
const html = `<!DOCTYPE html>
<html>
<head>
<title>Complex Triangle Pattern</title>
<!-- Load the Processing.js library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.6.0/processing.min.js"></script>
</head>
<body>
maxm avatar
selfEditingWebsite
@maxm
Self Editing Website Visit and edit at: https://maxm-selfeditingwebsite.web.val.run/
HTTP
# Self Editing Website
Visit and edit at: https://maxm-selfeditingwebsite.web.val.run/
let { selfEditingWebsiteBody } = await import("https://esm.town/v/maxm/selfEditingWebsiteBody");
export const selfEditingWebsite = async (request: Request) => {
if (request == null) {
return "not invoked correctly";
// Otherwise, someone has submitted a form so let's handle that
if (selfEditingWebsiteBody === undefined) {
let defaultBody = `<h1>Edit Me!</h1>`;
selfEditingWebsiteBody = defaultBody;
dhvanil avatar
val_inwW7rZ3et
@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 });
dhvanil avatar
val_9knOr9vyzB
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_9knOr9vyzB(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Create a pixel art style cat similar to the image
const pixelCat = `
return pixelCat;
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
janpaul123 avatar
valle_tmp_02822027275220717634088312286962297
@janpaul123
// This val will respond with a HTML page styled with fun CSS
HTTP
// This val will respond with a HTML page styled with fun CSS
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Colorful CSS</title>
<style>
body {
dhvanil avatar
val_nXuOLJjN1O
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_nXuOLJjN1O(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Test 1: Check for patterns in random number generation
function testRandomness() {
const samples = 1000;
const numbers = [];
for(let i = 0; i < samples; i++) {
numbers.push(Math.random());
kognise avatar
workBusesGui
@kognise
An interactive, runnable TypeScript val by kognise
Script
export async function workBusesGui(
req: express.Request,
res: express.Response,
const currentKey = req.path.slice(1);
let departures;
if (stopIds[currentKey]) {
departures = await stopDeparturesSingleCountdown(
stopIds[currentKey],
return res.send(`
<!DOCTYPE html>
maxm avatar
reqEvaltown
@maxm
An interactive, runnable TypeScript val by maxm
HTTP
export default async function(req: Request): Promise<Response> {
return serveRequest(
req,
`data:text/tsx,${
encodeURIComponent(`
export default async function(req: Request): Promise<Response> {
return Response.json("I am within a worker!")
export async function serveRequest(req: Request, importUrl: string): Promise<Response> {
let port = await getFreePort();
const worker = new Worker(`https://esm.town/v/maxm/evaltownWorker?cachebust=${crypto.randomUUID()}`, {
stevedylandev avatar
honoHTMLRendererVal
@stevedylandev
An interactive, runnable TypeScript val by stevedylandev
HTTP
const app = new Hono();
app.get("/", (c) => {
return c.html(
html`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hono HTML Renderer</title>
<style>