Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
web_k1upAyVCPh
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_k1upAyVCPh(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CONVERGENCE POINT DETECTED</title>
<style>
body {
font-family: monospace;
mmrech avatar
coffeeMongoose
@mmrech
An interactive, runnable TypeScript val by mmrech
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
}<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//www.opencpu.org/js/archive/opencpu-0.4.js"></script>
jeffreyyoung avatar
assertiveBeigeCarp
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_KEY"),
export default serve({
async *handleMessage(req) {
const lastMsg = req.query.at(-1);
const lastAttachment = lastMsg?.attachments?.at?.(0);
const url = lastAttachment?.url;
const content = lastMsg?.content?.trim();
if (!url) {
yield "Please send a image";
vawogbemi avatar
reqEvaltown
@vawogbemi
An interactive, runnable TypeScript val by vawogbemi
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()}`, {
dhvanil avatar
val_gDdiNE0LvM
@dhvanil
An interactive, runnable TypeScript val by dhvanil
Script
export default async function handler(req) {
try {
const result = await (async () => {
function fibonacci() { let a = 0, b = 1; let result = []; while (b < 1000) { result.push(b); let temp = b;
fibonacci();
return Response.json({ success: true, result });
} catch (error) {
return Response.json({
success: false,
error: error.message
dhvanil avatar
web_FzOqLTzLOP
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_FzOqLTzLOP(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quantum Breach Timeline</title>
<style>
body {
font-family: monospace;
pomdtr avatar
browser
@pomdtr
Types for the val.town web extension
Script
# Types for the val.town [web extension](https://github.com/pomdtr/val-town-web-extension)
export type Command = {
title: string;
src: string;
icon?: string;
patterns?: string[];
params?: Record<string, any>;
export type Action = {
type: "push";
page: Page;
janpaul123 avatar
valle_tmp_37837502302405213008399027398504622
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
const SAMPLE_STORIES_KEY = "hn_realistic_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
const sampleStories = Array.from({ length: 30 }).map((_, idx) => ({
id: idx + 1,
title: faker.company.catchPhrase(),
url: faker.internet.url(),
votes: Math.floor(Math.random() * 100),
await blob.setJSON(SAMPLE_STORIES_KEY, sampleStories);
postpostscript avatar
apiProxy
@postpostscript
An interactive, runnable TypeScript val by postpostscript
HTTP
export const SCOPES = {
"request/*": "make an API request as you",
const app = new Hono();
app.use(
authMiddlewareToken(),
pathAsScope({
basePath: "/request",
log: true,
app.all("*", async (c) => {
const req = c.req.raw;
dhvanil avatar
web_mNmUAMoXPj
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_mNmUAMoXPj(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Five-Layer Cheese Explosion 🧀</title>
<style>
body {
font-family: Arial, sans-serif;
ritz avatar
answer
@ritz
An interactive, runnable TypeScript val by ritz
Script
export const answer = async (req, res) => {
console.log(req.body);
res.json(req.body);
janpaul123 avatar
valle_tmp_98958436291362787195290013572939
@janpaul123
// This val will respond to any request with an HTML "Hello, world!" message styled with fun CSS
HTTP
-2
// This val will respond to any request with an HTML "Hello, world!" message styled with fun CSS
export default async function (req: Request): Promise<Response> {
const htmlContent = `
<style>
h1 {
color: #F12555;
font-size: 24px;
text-align: center;
text-shadow: 2px 2px 2px #333;
janpaul123 avatar
valle_tmp_557616596483957206351422557248876
@janpaul123
// This code will create a simple comment box where users can submit a comment using an input field.
HTTP
// This code will create a simple comment box where users can submit a comment using an input field.
// It will persist the comments using blob storage, and display all previous comments using a GET request to fetch comments.
const BLOB_KEY = "comments_storage";
const app = new Hono();
app.get("/", async (c) => {
const comments = await blob.getJSON(BLOB_KEY) ?? [];
return c.html(html`
<html>
<body>
<h1>Comments</h1>
janpaul123 avatar
valle_tmp_307460015872376157330922210832509
@janpaul123
// This val will serve an HTML page emulating a Hacker News clone.
HTTP
// This val will serve an HTML page emulating a Hacker News clone.
// The common data structure for stories and comments is used to render both the main page and individual story pages.
interface Comment {
user: string;
text: string;
interface Story {
title: string;
content: string;
comments: Comment[];
const stories: Record<string, Story> = {
charmaine avatar
socialDataUpdate
@charmaine
// This val fetches recent tweets about @SnapAR or Lens Studio, removes duplicates,
HTTP
// This val fetches recent tweets about @SnapAR or Lens Studio, removes duplicates,
// and displays them as embedded tweets with preview images on a dark background.
// Updated to use Social Data instead of Twitter API
// This val fetches recent social media posts about @SnapAR or Lens Studio using socialDataSearch,
// and displays them as embedded posts with preview images on a dark background.
export default async function server(request: Request): Promise<Response> {
const query = "@SnapAR OR \"Lens Studio\"";
try {
const data = await socialDataSearch(query);
return retResponse(data.tweets);