Search

Results include substring matches and semantically similar vals. Learn more
vez avatar
shittyValTownUI
@vez
An interactive, runnable TypeScript val by vez
Script
export async function shittyValTownUI(req, res) {
const editVal = (body: {
code: string;
name?: string;
isInterval?: boolean;
`fetch('https://api.val.town/eval/@vez.editVal(${JSON.stringify(body)})')`;
return res.send(`<h1>Shitty Val Town 2</h1>
${(await getAllVals("@vez")).map(({ code, name }) => {
const editorId = `${name}-editor`;
const onClick = `(document.getElementById('${name}-button').textContent = 'save 🔄'), fetch('https://api.val.town/eval/@vez
dhvanil avatar
val_6ZdZ89Aqqh
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_6ZdZ89Aqqh(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const calculateFractalDimension = (points) => { const boxCount = (size) => { let count = 0; for (let i = 0; i < p
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
ngmi avatar
immenseBlushSpider
@ngmi
An interactive, runnable TypeScript val by ngmi
HTTP
const API_KEY = Deno.env.get("FARCASTER_API_KEY");
const API_URL = "https://build.wield.xyz/farcaster/v2/feed";
export default async function server(request: Request): Promise<Response> {
let feedItems = [];
let error = null;
if (!API_KEY) {
error = "API key is not set. Please configure the FARCASTER_API_KEY environment variable.";
} else {
async function fetchFeedItems() {
try {
easrng avatar
playground
@easrng
playground edit, run, and embed vals without requiring an account (or even js enabled!) caveats: logs don't stream I haven't set up codemirror only script vals supported everything else should be fully functional. you can prefill the editor with code: https://easrng-playground.web.val.run/?code=console.log(1) a val: https://easrng-playground.web.val.run/?load=easrng/playground some other url: https://easrng-playground.web.val.run/?load=https://any/other/url
HTTP
# playground
## edit, run, and embed vals without requiring an account (or even js enabled!)
[![open](https://easrng-button.express.val.run/open)](https://easrng-playground.web.val.run/)
caveats:
- logs don't stream
- I haven't set up codemirror
// (c) easrng 2024 all rights reserved
/** @jsx jsx */
/** @jsxFrag Fragment */
createContext,
kajgod avatar
njuskaloCreateHtmlResponse
@kajgod
An interactive, runnable TypeScript val by kajgod
Script
export const njuskaloCreateHtmlResponse = (
res: express.Response,
formHtml: string,
dataHtml: string,
res.send(`
<!DOCTYPE html>
<html>
<head>
<title>Njuškalo sniffer</title>
</head>
pomdtr avatar
password_auth
@pomdtr
Password Auth Middleware Protect your vals behind a password. Use session cookies to persist authentication. Usage import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=84"; export default passwordAuth(() => { return new Response("OK"); }, { verifyPassword: (password) => password == Deno.env.get("VAL_PASSWORD") }); If you want to use an api token to authenticate: import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=84"; import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken"; export default passwordAuth(() => { return new Response("OK"); }, { verifyPassword: verifyToken }); TODO [x] allow to authenticate using a val town token [ ] add a way to send an email to ask a password from the val owner [ ] automatically extend the session [ ] automatically remove expired sessions FAQ How to sign out ? Navigate to <your-site>/signout .
Script
# Password Auth Middleware
Protect your vals behind a password. Use session cookies to persist authentication.
![6ed0648ae8813e958dbe79468572cb52f578239c0fae55857a13660beebdc5fd.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/36c1
## Usage
```ts
export default passwordAuth(() => {
type Session = {
id: string;
expiresAt: number;
async function createSessionTable(tableName: string) {
dhvanil avatar
val_prZ5olhiXD
@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 });
stevekrouse avatar
qr
@stevekrouse
// Forked from @ramkarthik.GenerateQR
Express (deprecated)
export async function qr(req: express.Request, res: express.Response) {
if (req.path.startsWith("/qr")) {
const { qrcode } = await import("https://deno.land/x/qrcode/mod.ts");
const base64Image = await qrcode(req.query.data);
res.set("content-type", "image/gif");
res.send(
Buffer.from(base64Image.replace("data:image/gif;base64,", ""), "base64"),
else {
res.send(`<html>
<div>
janpaul123 avatar
valle_tmp_463480496454860730332801536131093
@janpaul123
// This updated val serves an HTML page emulating a Hacker News clone.
HTTP
// This updated val serves an HTML page emulating a Hacker News clone.
// It now has clickable titles that will serve pages with some fake story content.
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const path = url.pathname;
if (path === "/") {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
dhvanil avatar
val_RcFf3oHVQl
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_RcFf3oHVQl(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Exploit proof-of-concept for matrix precision glitch
const exploitPrecisionGlitch = () => {
// Create a function that forces values into specific rational states
const forceValueSnap = (value, target) => {
// Use extremely high precision to force rational interpretation
const precision = 1000000000000;
dhvanil avatar
val_4TWAFb0mDp
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_4TWAFb0mDp(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const calculateFractalDimension = (points) => { const boxCount = (size) => { let count = 0; for (let i = 0; i < p
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
adagradschool avatar
kindApricotAnglerfish
@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",
pomdtr avatar
blob_admin_blob
@pomdtr
@jsxImportSource https://esm.sh/hono@4.0.8/jsx
Script
/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
const route = new Hono();
route.get("/:key", async (c) => {
const key = c.req.param("key");
let response = await blob.get(key);
let text = await response.text();
return c.render(
<div>
<h1>{key}</h1>
<code-mirror code={text} readonly></code-mirror>
janpaul123 avatar
valle_tmp_821221338019192827080648147114728
@janpaul123
// This HTTP val will generate an HTML frontend for a simple Hacker News clone.
HTTP
// This HTTP val will generate an HTML frontend for a simple Hacker News clone.
// It will use hardcoded example stories for now and display them in a clean layout.
const app = new Hono();
const exampleStories = [
title: "Introducing Val Town",
url: "https://val.town",
points: 100,
author: "Steve Krouse",
comments: 30,
title: "Hacker News Clone with Val Town",
maxencelav avatar
createFileInputApp
@maxencelav
An interactive, runnable TypeScript val by maxencelav
HTTP
export default function server(req: Request): Response {
return new Response(`
<!DOCTYPE html>
<html>
<head>
<title>File Input Cloner</title>
<style>
.container {
padding: 20px;
font-family: system-ui, sans-serif;