Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
val_EDJACH3UXU
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_EDJACH3UXU(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const chiSquaredTest = (observed, expected) => {
let chiSquared = 0;
for (let i = 0; i < observed.length; i++) {
chiSquared += Math.pow(observed[i] - expected[i], 2) / expected[i];
return chiSquared;
const observedCounts = [100, 107, 94, 106, 79, 94, 108, 96, 117, 99];
janpaul123 avatar
valle_tmp_086165512507909492839503439700437
@janpaul123
// This val will respond with a styled HTML page with fun CSS
HTTP
// This val will respond with a styled HTML page with fun CSS
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
<style>
body {
janpaul123 avatar
valle_tmp_24465193590789676547245511636799
@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>Hello World</title>
<style>
body {
cyrilos avatar
loop
@cyrilos
An interactive, runnable TypeScript val by cyrilos
HTTP
const TARGET = 1000 * 10;
async function loop() {
var url = "https://cyrilos-loop.web.val.run";
await axios({
method: "get",
url: url,
/* bet session */
async function playDice() {
const PLATFORM = "polpick.io";
const cookies = await blob.getJSON("platforms");
janpaul123 avatar
valle_tmp_03532894464414715356178372159367935
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
// This function returns an HTML response with a "Hello, World!" message styled using CSS
// to have crazy colors and gradien
export default async function main(req: Request) {
const body = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello WorldCrazy Colors</title>
dhvanil avatar
web_sirdp0W9N6
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_sirdp0W9N6(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simulation Prison Analysis - Updated</title>
<style>
body {
font-family: monospace;
chet avatar
watchWebsite
@chet
An interactive, runnable TypeScript val by chet
Script
export async function watchWebsite(url: string) {
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) {}
await blob.set(key, newHtml);
if (!oldHtml) return console.log("NO OLD", { oldHtml, newHtml });
const diff = diffHtml(oldHtml, newHtml);
janpaul123 avatar
valle_tmp_578893276058611408404753009261645
@janpaul123
// This val will respond with an HTML page saying "Hello, world!" with fun CSS.
HTTP
// This val will respond with an HTML page saying "Hello, world!" with fun CSS.
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@700&family=Permanent+Marker&display=swap');
ant avatar
runner
@ant
An interactive, runnable TypeScript val by ant
Script
export function runner(req, resp) {
console.log(req);
console.log(resp);
moe avatar
frameHtmlRaw
@moe
An interactive, runnable TypeScript val by moe
Script
export const frameHtml = (frame, baseUrl = "") => {
const prefixUrl = url => baseUrl && url.startsWith("/") ? `${baseUrl}${url}` : url
const aspectRatio = frame.aspectRatio || "1.91:1"
const buttonsHtml = frame.buttons.map((b, i) => (`
<meta property="${`fc:frame:button:${i + 1}`}" content="${b.text}" />
<meta property="${`fc:frame:button:${i + 1}:target`}" content="${prefixUrl(b.target)}" />
<meta property="${`of:button:${i + 1}`}" content="${b.text}" />
<meta property="${`of:button:${i + 1}:target`}" content="${prefixUrl(b.target)}" />
return (
<meta property="fc:frame" content="vNext" />
chet avatar
notionSiteProxy
@chet
// NOTE: This doesn't work great.
HTTP
// NOTE: This doesn't work great.
const valDomain = "chet-notionSiteProxy.web.val.run";
const notionPage = "https://chetcorcos.notion.site/0e27612403084b2fb4a3166edafd623a";
export default async function(req: Request): Promise<Response> {
const notionUrl = new URL(notionPage);
const notionDomain = notionUrl.host;
const url = new URL(req.url);
if (url.pathname === "/") {
url.host = valDomain;
url.pathname = notionUrl.pathname;
dhvanil avatar
val_Lp66OGSTA8
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_Lp66OGSTA8(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,
psimyn avatar
blobAdmin
@psimyn
Blob Admin This is a lightweight Blob Admin interface to view and debug your Blob data. Use this button to install the val: It uses basic authentication with your Val Town API Token as the password (leave the username field blank). TODO [x] /new - render a page to write a new blob key and value [x] /edit/:blob - render a page to edit a blob (prefilled with the existing content) [x] /delete/:blob - delete a blob and render success [x] add upload/download buttons [ ] Use modals for create/upload/edit/view/delete page (htmx ?) [ ] handle non-textual blobs properly [ ] use codemirror instead of a textarea for editing text blobs
HTTP
# Blob Admin
This is a lightweight Blob Admin interface to view and debug your Blob data.
![b7321ca2cd80899250589b9aa08bc3cae9c7cea276282561194e7fc537259b46.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/311a
Use this button to install the val:
[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/s
/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
const app = new Hono();
app.use(
jsxRenderer(({ children }) => {
dhvanil avatar
val_hTN41dqWCU
@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 });
ryanguill avatar
roamForm
@ryanguill
An interactive, runnable TypeScript val by ryanguill
Express (deprecated)
let { submittedEmailAddresses } = await import("https://esm.town/v/ryanguill/submittedEmailAddresses");
export const roamForm =
(async (req: express.Request, res: express.Response) => {
const thisURL = thisExpressURL();
if (req.method === "GET") {
return res.send(layout(`
<form action="${thisURL}" method="post">
<form class="align-items-center">
<div class="row">
<div class="col-auto">