Search
valle_tmp_8524715891926958662818742653551
@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.
// It uses plain HTML and CSS to create the frontend. Eventually,
// we can make it interactive with additional scripts.
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
val_yRrm2hE8eu
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_yRrm2hE8eu(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const visualizeData = (data) => { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); canvas.width = 800; canvas.height = 400; document.body.appendChild(canvas); const maxCount = Math.max(...Object.values(data)); const barWidth = canvas.width / Object.keys(data).length; Object.entries(data).forEach(([num, count], index) => { const barHeight = (count / maxCount) * canvas.height; ctx.fillStyle = 'blue'; ctx.fillRect(index * barWidth, canvas.height - barHeight, barWidth - 1, barHeight); ctx.fillStyle = 'black'; ctx.fillText(num, index * barWidth + barWidth / 2 - 5, canvas.height - barHeight - 5); }); }; visualizeData({"0":98,"1":86,"2":97,"3":97,"4":93,"5":112,"6":93,"7":106,"8":108,"9":89,"10":106,"11":108,"12":87,"13":112,"14":96,"15":93,"16":112,"17":96,"18":97,"19":86,"20":100,"21":102,"22":101,"23":85,"24":95,"25":103,"26":86,"27":92,"28":109,"29":107,"30":95,"31":102,"32":107,"33":92,"34":96,"35":99,"36":100,"37":104,"38":88,"39":115,"40":97,"41":90,"42":113,"43":102,"44":103,"45":92,"46":81,"47":101,"48":98,"49":95,"50":88,"51":92,"52":94,"53":100,"54":107,"55":99,"56":102,"57":96,"58":90,"59":95,"60":106,"61":111,"62":83,"63":109,"64":98,"65":98,"66":108,"67":102,"68":122,"69":102,"70":82,"71":98,"72":109,"73":99,"74":94,"75":94,"76":127,"77":103,"78":93,"79":111,"80":106,"81":98,"82":105,"83":111,"84":106,"85":104,"86":94,"87":102,"88":101,"89":99,"90":101,"91":105,"92":98,"93":121,"94":89,"95":110,"96":103,"97":95,"98":103,"99":115});
// Return the result in a properly formatted response
return new Response(JSON.stringify({
result: result,
type: typeof result
headers: { 'Content-Type': 'application/json' }
claude_new
@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>\n <meta charset=\"UTF-8\">\n <style>\n body {\n font-family: system-ui, -apple-system, sans-serif;\n line-height: 1.5;\n max-width: 800px;\n margin: 0 auto;\n padding: 20px;\n background: #f9fafb;\n }\n .message {\n margin: 20px 0;\n padding: 15px;\n border-radius: 8px;\n }\n .human {\n background: #e5e7eb;\n }\n .assistant {\n background: #dbeafe;\n }\n .role {\n font-weight: bold;\n margin-bottom: 8px;\n }\n </style>\n </head>\n <body>\n \n </body>\n </html>\n"`, {
headers: {
"Content-Type": "text/html",
ai
@yawnxyz
An http and class wrapper for Vercel's AI SDK Usage: Groq: https://yawnxyz-ai.web.val.run/generate?prompt="tell me a beer joke"&provider=groq&model=llama3-8b-8192 Perplexity: https://yawnxyz-ai.web.val.run/generate?prompt="what's the latest phage directory capsid & tail article about?"&provider=perplexity Mistral: https://yawnxyz-ai.web.val.run/generate?prompt="tell me a joke?"&provider=mistral&model="mistral-small-latest" async function calculateEmbeddings(text) {
const url = `https://yawnxyz-ai.web.val.run/generate?embed=true&value=${encodeURIComponent(text)}`;
try {
const response = await fetch(url);
const data = await response.json();
return data;
} catch (error) {
console.error('Error calculating embeddings:', error);
return null;
}
}
HTTP
An http and class wrapper for Vercel's AI SDK
Usage:
- Groq: `https://yawnxyz-ai.web.val.run/generate?prompt="tell me a beer joke"&provider=groq&model=llama3-8b-8192`
- Perplexity: `https://yawnxyz-ai.web.val.run/generate?prompt="what's the latest phage directory capsid & tail article about?"&provider=perplexity`
- Mistral: `https://yawnxyz-ai.web.val.run/generate?prompt="tell me a joke?"&provider=mistral&model="mistral-small-latest"`
async function calculateEmbeddings(text) {
// import { z } from "npm:zod";
// import { nanoid } from 'npm:nanoid';
const URL = "https://yawnxyz-coversheetai.web.val.run"
const taskPrefix = "task::ai:"
valle_tmp_767612537409962736882223362511657
@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.
// It uses plain HTML and CSS to create the frontend. Eventually,
// we can make it interactive with additional scripts.
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
web_c9Qpa86DyZ
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_c9Qpa86DyZ(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cyberpunk Disco Party</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<style>
dateme_home
@iamseeley
@jsxImportSource npm:hono@3/jsx
Script
/** @jsxImportSource npm:hono@3/jsx */
export default function Home(c) {
const AutocompleteInput = () => {
const [inputValue, setInputValue] = useState('');
const [filteredLocations, setFilteredLocations] = useState([]);
const [isOpen, setIsOpen] = useState(false);
const handleInputChange = (e) => {
const value = e.target.value;
setInputValue(value);
setIsOpen(true);
hackerNewsDigest
@roramigator
Hacker News Digest Fork this val to get an email like this in your inbox!
Cron
# Hacker News Digest
Fork this val to get an email like this in your inbox!
<img width="400px" src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/2661d748-d7a7-4d1e-85a4-f60fae262000/public" />
// This cron emails Hacker News stories from its API every 3 days.
async function fetchStories(type: string, count: number) {
const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
const storyIds = await response.json();
const stories = await Promise.all(
storyIds.slice(0, count).map(async (id: number) => {
const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
blob_admin_edit
@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("/:name", async (c) => {
const name = c.req.param("name");
const resp = await blob.get(name);
const content = await resp.text();
return c.render(
<form method="POST">
<h1>
<input name="new_name" value={name} />
valle_tmp_629217472160119437705927512967885
@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.
// It uses plain HTML and CSS to create the frontend. Eventually,
// we can make it interactive with additional scripts.
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
web_mqybI9ybHZ
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_mqybI9ybHZ(req) {
return new Response(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vibrant Web Design Showcase</title>
<style>
body {
font-family: 'Arial', sans-serif;
frame
@nlnw
Minimal val.town Farcaster Frame example. It supports dynamic image generation with Satori and ReSVG, and it's compatible with the Open Frames standard.
HTTP
Minimal val.town Farcaster Frame example. It supports dynamic image generation with Satori and ReSVG, and it's compatible with the Open Frames standard.
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
async function renderImage(s: string, color: string) {
const fontArrayBuf = await fetch(
"https://cdn.jsdelivr.net/npm/roboto-font@0.1.0/fonts/Roboto/roboto-regular-webfont.ttf",
).then((res) => res.arrayBuffer());
const svg = await satori(
type: "div",
props: {
dateme_home
@vawogbemi
@jsxImportSource npm:hono@3/jsx
Script
/** @jsxImportSource npm:hono@3/jsx */
export default function Home(c) {
return c.html(
<Layout activeTab={new URL(c.req.url).pathname}>
<div class="max-w-lg mx-auto p-10">
<div class="mb-10">
<div class="text-4xl font-bold mb-4">
I'm looking for a Man In Finance.
</div>
<div class="text-lg ">
scarletSole
@temptemp
An interactive, runnable TypeScript val by temptemp
HTTP
interface Context {
url: string;
const app = new Hono();
app.get("/dood/:dood", async (c) => {
const { dood } = c.req.param();
const ctx = { url: "https://d000d.com/e/" + dood };
return c.json(await doodstream(ctx));
app.get("/tape/:tape", async (c) => {
const { tape } = c.req.param();
const ctx = { url: "https://streamtape.com/e/" + tape };
claude_96d58357_f689_4969_90e1_10f04f012b9d
@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>\n <meta charset=\"UTF-8\">\n <style>\n body {\n font-family: system-ui, -apple-system, sans-serif;\n line-height: 1.5;\n max-width: 800px;\n margin: 0 auto;\n padding: 20px;\n background: #f9fafb;\n }\n .message {\n margin: 20px 0;\n padding: 15px;\n border-radius: 8px;\n }\n .human {\n background: #e5e7eb;\n }\n .assistant {\n background: #dbeafe;\n }\n .role {\n font-weight: bold;\n margin-bottom: 8px;\n }\n </style>\n </head>\n <body>\n \n <div class=\"message human\">\n <div class=\"role\">Human</div>\n <div class=\"content\">export default function handler(req) {\n return new Response(\n <!DOCTYPE html>\n <html>\n <head>\n <title>Claude Chat Conversation</title>\n <meta charset="UTF-8">\n <style>\n body {\n font-family: system-ui, -apple-system, sans-serif;\n line-height: 1.5;\n max-width: 800px;\n margin: 0 auto;\n padding: 20px;\n background: #f9fafb;\n }\n .message {\n margin: 20px 0;\n padding: 15px;\n border-radius: 8px;\n }\n .human {\n background: #e5e7eb;\n }\n .assistant {\n background: #dbeafe;\n }\n .role {\n font-weight: bold;\n margin-bottom: 8px;\n }\n </style>\n </head>\n <body> <div class="message human">\n <div class="role">Human</div>\n <div class="content">so, how was your day</div>\n </div> <div class="message assistant">\n <div class="role">Claude</div>\n <div class="content">I aim to have authentic conversations while being direct about my nature as an AI. While I appreciate the friendly question, I should note that I don't actually experience days in the way humans do. I'd be happy to hear about your day though, or to help you with any questions or tasks you might have.</div>\n </div> </body>\n, {\n headers: {\n \"Content-Type\": \"text/html\",\n },\n });\n }What is the issue with this?</div>\n </div>\n \n <div class=\"message assistant\">\n <div class=\"role\">Claude</div>\n <div class=\"content\">Let me help you fix this code. There are a few syntax issues with the current implementation.\nFixed Next.js API HandlerClick to open code\nThe main issues with the original code were:\n\nThe HTML string was not properly formatted - it was directly inserted after the Response( without being enclosed in quotes or backticks\nHTML entities were escaped (<, >, ") when they should have been regular characters (<, >, \")\nNo proper string formatting was used (should use template literals with backticks for multiline strings in JavaScript)\n\nThe fixed version:\n\nUses a template literal (backticks) to properly contain the multiline HTML string\nUses proper HTML syntax without escaped entities\nProperly separates the HTML string from the Response constructor\nMaintains proper indentation for readability\nKeeps the same functionality but in a syntactically correct way\n\nThis should now work correctly as a Next.js API route handler that returns an HTML page.</div>\n </div>\n \n <div class=\"message human\">\n <div class=\"role\">Human</div>\n <div class=\"content\">obj = {\"success\":true,\"val\":{\"id\":\"ab43fa1c-9f05-11ef-ba42-de64eea55b61\",\"author\":{\"id\":\"a15e59cc-3d10-47ad-9065-d19718204f1b\",\"username\":\"adagradschool\"},\"name\":\"claude_d482d9ee_eff3_42e6_9779_a012b1e1f7b4\",\"type\":\"http\",\"code\":\"\\n export default function handler(req) {\\n return new Response(\\\"\\\\n <!DOCTYPE html>\\\\n <html>\\\\n <head>\\\\n <title>Claude Chat Conversation</title>\\\\n <meta charset=\\\\\\\"UTF-8\\\\\\\">\\\\n <style>\\\\n body {\\\\n font-family: system-ui, -apple-system, sans-serif;\\\\n line-height: 1.5;\\\\n max-width: 800px;\\\\n margin: 0 auto;\\\\n padding: 20px;\\\\n background: #f9fafb;\\\\n }\\\\n .message {\\\\n margin: 20px 0;\\\\n padding: 15px;\\\\n border-radius: 8px;\\\\n }\\\\n .human {\\\\n background: #e5e7eb;\\\\n }\\\\n .assistant {\\\\n background: #dbeafe;\\\\n }\\\\n .role {\\\\n font-weight: bold;\\\\n margin-bottom: 8px;\\\\n }\\\\n </style>\\\\n </head>\\\\n <body>\\\\n \\\\n <div class=\\\\\\\"message human\\\\\\\">\\\\n <div class=\\\\\\\"role\\\\\\\">Human</div>\\\\n <div class=\\\\\\\"content\\\\\\\">so, how was your day</div>\\\\n </div>\\\\n \\\\n <div class=\\\\\\\"message assistant\\\\\\\">\\\\n <div class=\\\\\\\"role\\\\\\\">Claude</div>\\\\n <div class=\\\\\\\"content\\\\\\\">I aim to have authentic conversations while being direct about my nature as an AI. While I appreciate the friendly question, I should note that I don't actually experience days in the way humans do. I'd be happy to hear about your day though, or to help you with any questions or tasks you might have.</div>\\\\n </div>\\\\n \\\\n </body>\\\\n\\\", {\\n headers: {\\n \\\"Content-Type\\\": \\\"text/html\\\",\\n },\\n });\\n }\\n \",\"privacy\":\"public\",\"public\":true,\"version\":0,\"createdAt\":\"2024-11-10T01:46:56.862Z\",\"readme\":null,\"likeCount\":0,\"referenceCount\":0,\"url\":\"https://www.val.town/v/adagradschool/claude_d482d9ee_eff3_42e6_9779_a012b1e1f7b4\",\"links\":{\"self\":\"https://api.val.town/v1/vals/ab43fa1c-9f05-11ef-ba42-de64eea55b61\",\"versions\":\"https://api.val.town/v1/vals/ab43fa1c-9f05-11ef-ba42-de64eea55b61/versions\",\"module\":\"https://esm.town/v/adagradschool/claude_d482d9ee_eff3_42e6_9779_a012b1e1f7b4?v=0\",\"endpoint\":\"https://adagradschool-claude_d482d9ee_eff3_42e6_9779_a012b1e1f7b4.web.val.run\"}}}Get val's endpoint</div>\n </div>\n \n <div class=\"message assistant\">\n <div class=\"role\">Claude</div>\n <div class=\"content\">Looking at the JSON object, the endpoint URL can be found at obj.val.links.endpoint, which is:\nhttps://adagradschool-claude_d482d9ee_eff3_42e6_9779_a012b1e1f7b4.web.val.run</div>\n </div>\n \n </body>\n </html>\n"`, {
headers: {
"Content-Type": "text/html",