Search
debugCheerioEx
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const debugCheerioEx = (async () => {
var cheerio = await import("npm:cheerio");
console.log(Object.keys(cheerio));
valle_tmp_305701972711345937273198924748763
@janpaul123
// This val will respond with a colorful and fun HTML page
HTTP
// This val will respond with a colorful and fun HTML page
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fun Page</title>
<style>
body {
comment
@soxfox42
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
export async function comment(request: Request) {
let message;
if (request.method === "POST") {
const formData = await request.formData();
message = formData.get("message");
await sqlite.execute({
sql: `update kv set value = :message where key = 'comment'`,
args: { message },
} else {
renderHtm
@pomdtr
// '<h1 id="hello">Hello world!</h1>'
Script
export async function renderHtm(req: express.Request, res: express.Response) {
try {
const { default: htm } = await import("npm:htm");
const { default: vhtml } = await import("npm:vhtml");
const html = htm.bind(vhtml);
res.send(html`<h1 id=hello>Hello!</h1>`);
catch (e) {
return `An error occured: ${e}`;
// '<h1 id="hello">Hello world!</h1>'
todo_list
@abzwpspcgen
// Forked from @tmcw.todo_list
Script
let { todos } = await import("https://esm.town/v/tmcw/todos?v=354");
export let todo_list = (async (req, res) => {
const { default: htm } = await import("npm:htm");
const { default: vhtml } = await import("npm:vhtml");
const html = htm.bind(vhtml);
const renderTodo = (todo) => {
return html`<li data-id=${todo.id}>
<label>
<input hx-delete="/" hx-target="[data-id='${todo.id}']" hx-swap="delete" style='display:inline;margin-right:0.5rem;' type='checkbox' name="id" value=${todo.id} />
${todo.name}
valle_tmp_4374095821764219776697402648626
@janpaul123
// To create a simple JavaScript formatter, we can utilize the Prettier library available in Deno.
HTTP
// To create a simple JavaScript formatter, we can utilize the Prettier library available in Deno.
// Prettier helps format and beautify JavaScript code.
// This val will take JavaScript code as input and format it using Prettier.
import { format } from "npm:prettier/standalone";
import parserBabel from "npm:prettier/parser-babel";
export default async function(req: Request): Promise<Response> {
const { code } = await req.json();
const formattedCode = format(code, {
parser: "babel",
plugins: [parserBabel],
return new Response(formattedCode, { headers: { "Content-Type": "text/plain" } });
valle_tmp_02813526388152065610334668933305768
@janpaul123
// This val will respond with a "Hello World" HTML page styled with fun CSS
HTTP
// This val will respond with a "Hello World" HTML page styled with fun CSS
export default async function(req: Request): Promise<Response> {
// CSS styles to make the text colorful and centered
const cssStyles = `<style>h1 { color: purple; text-align: center; }</style>`;
// HTML content with the styled "Hello World" message
const htmlContent = `<html><head>${cssStyles}</head><body><h1>Hello World!</h1></body></html>`;
// Send an HTML response with the CSS styling
return new Response(htmlContent, {
headers: {
"Content-Type": "text/html",
Countdown2
@all
// This val will serve an HTML countdown timer to April 14, 2025.
HTTP
// This val will serve an HTML countdown timer to April 14, 2025.
// It uses CSS for styling and animations and JavaScript for the countdown logic.
export default async function main(req: Request): Promise<Response> {
const html = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Countdown to 2025 Event Kickoff</title>
val_PmJtq5HUb4
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_PmJtq5HUb4(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const generateRandomNumbers = (count) => {
const randomNumbers = [];
for (let i = 0; i < count; i++) {
randomNumbers.push(Math.random());
return randomNumbers;
const checkForPatterns = (numbers) => {
draw
@yieldray
Draw
HTTP
# [Draw](https://yieldray-draw.web.val.run)
export const draw = () =>
new Response(
webpage(
title: "draw",
header: `<h1>Draw</h1>`,
footer: "<p>Powered by val.town</p>",
form(
action: "https://lily.deno.dev/",
method: "POST",
valle_tmp_94143382773309364168680595093273
@janpaul123
// This val responds with an HTML form styled with CSS to input the user's name and greets them upon form submission
HTTP
// This val responds with an HTML form styled with CSS to input the user's name and greets them upon form submission
export default async function(req: Request): Promise<Response> {
if (req.method === "POST") {
const formData = new URLSearchParams(await req.text());
const name = formData.get("name") || "stranger";
const htmlResponse = `
<style>
body { font-family: Arial, sans-serif; text-align: center; }
input[type="text"] { padding: 8px; margin: 5px; }
input[type="submit"] { padding: 8px 20px; background-color: #4CAF50; color: white; border: none; cursor: pointer; }
valle_tmp_39414376122428222818488514998443
@janpaul123
// This val serves an HTML page with a form to enter your name.
HTTP
// This val serves an HTML page with a form to enter your name.
// When the form is submitted, it greets you with "Hello, <name>!".
// Modified to make the page styling more vibrant and eye-catching.
export default async function(req: Request): Promise<Response> {
let name = "";
if (req.method === "POST") {
const formData = await req.formData();
name = formData.get("name") as string || "";
const html = `
<!DOCTYPE html>
valle_tmp_43654664469855205133021678427796
@janpaul123
// This val creates a simple comment box where users can submit a comment,
HTTP
// This val creates a simple comment box where users can submit a comment,
// and it stores all comments in blob storage. It displays all previous comments
// and allows new comments to be added.
// Key for blob storage
const COMMENTS_KEY = "comments_storage";
// HTML template for the comment box
const template = (comments: any) => `
<html>
<head>
<title>Comment Box</title>
dateme
@stevekrouse
Date Me Directory This is entry-point val for the source code for the Date Me Directory. Contributions welcome! This app uses Hono as the server framework and for JSX . The vals are stored in Val Town SQLite . Contributing Forking this repo should mostly work, except for the sqlite database. You'll need to create the table & populate it with some data. This script should do it, but I think it has a couple bugs. If you're interested in contributing to this project contact me or comment on this val and I'll get it working for ya! Todos [ ] Make the SQLite database forkable and build a widget/workflow for that, ie fix @stevekrouse/dateme_sqlite [ ] Require an email (that isn't shared publicly) [ ] Verify the email address with a "magic link" [ ] Refactor Location to an array of Lat, Lon [ ] Geocode all the existing locations [ ] Add a geocoder map input to the form [ ] Allow selecting multiple location through the form [ ] Profile performance & speed up site, possibly add more caching [ ] Let people edit their forms [ ] Featured profiles
HTTP
# Date Me Directory
This is entry-point val for the source code for the Date Me Directory. Contributions welcome!
This app uses [Hono](https://hono.dev/) as the server framework and for [JSX](https://hono.dev/guides/jsx).
The vals are stored in [Val Town SQLite](https://docs.val.town/std/sqlite/).
## Contributing
Forking this repo should mostly work, except for the sqlite database. You'll need to create the table & populate it with some data. [This script](https://www.val.town/v/stevekrouse/dateme_sqlite) *should* do it, but I think it has a couple bugs. If you're interested in contributing to this project contact me or comment on this val and I'll get it working for ya!
const app = new Hono();
app.get("/", home);
app.get("/browse", browse);
app.route("/submit", form);
mgsrBotEndpoint
@rayman
// Forked from @mattx.examplebot_endpoint
Express (deprecated)
export let mgsrBotEndpoint = async (
req: express.Request,
res: express.Response,
console.log(req.get("X-Signature-Timestamp"));
console.log(req.get("X-Signature-Ed25519"));
if (!req.get("X-Signature-Timestamp") || !req.get("X-Signature-Ed25519")) {
res.status(400);
res.end("Signature headers missing!");
const verified = await verify_discord_signature(
process.env.discord_pubkey,