Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=function&page=1327&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 18323 results for "function"(1400ms)

1
2 export default function handler(req) {
3 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"`, {
4 headers: {

claudemain.tsx1 match

@adagradschool•Updated 5 months ago
1export default function handler(req) {
2 // The HTML string needs to be properly escaped and formatted as a template literal
3 const html = `<!DOCTYPE html>

claude_share_htmlmain.tsx1 match

@adagradschool•Updated 5 months ago
1export default function handler(req) {
2 return new Response(
3 "\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",

forwardermain.tsx1 match

@milesfalk•Updated 5 months ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {

uptimemain.tsx1 match

@bootspoon•Updated 5 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let reason: string, status: number, end: number;
10 let ok = true;

imageToAnsimain.tsx1 match

@g•Updated 5 months ago
28import { Chalk, type Options as ChalkOptions } from 'npm:chalk';
29
30export async function imageToAnsi(
31 src: string | Image,
32 opts?: Partial<

codecommentermain.tsx2 matches

@JamesAndrew•Updated 5 months ago
15);
16
17function App() {
18 const [input, setInput] = useState("");
19 const [output, setOutput] = useState("");
85}
86
87export default async function server(request: Request): Promise<Response> {
88 if (request.method === "POST" && new URL(request.url).pathname === "/comment") {
89 const { OpenAI } = await import("https://esm.town/v/std/openai");

sqliteExplorerAppREADME.md1 match

@sammeltassen•Updated 5 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

snugPinkHummingbirdmain.tsx1 match

@g•Updated 5 months ago
1import { imageToAnsi } from 'https://esm.town/v/g/imageToAnsi';
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5

us_election_color_schememain.tsx3 matches

@metart43•Updated 5 months ago
13
14// Define the Card component with the gray subtitle
15function ColorCard({ name, blue, red }) {
16 return (
17 <article
66
67// Define the main component to display all cards in a responsive grid layout
68function ColorCards() {
69 return (
70 <main
127}
128
129// Server-side rendering function with DOCTYPE, viewport meta tag, and rendered HTML
130export const reactExample = (request: Request) =>
131 new Response(

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.