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/image-url.jpg%20%22Image%20title%22?q=function&page=2539&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 28713 results for "function"(3028ms)

35`;
36
37export default async function main(req: Request): Promise<Response> {
38 // Fetch existing comments
39 let comments: string[] = await blob.getJSON(COMMENTS_KEY) || [];
9const key = "comments";
10
11async function getComments(): Promise<Array<{ id: string; content: string }>> {
12 const comments = await blob.getJSON(key) as Array<{ id: string; content: string }> | undefined;
13 return comments ?? [];
14}
15
16async function addComment(content: string) {
17 const comments = await getComments();
18 comments.push({ id: ulid(), content });
20}
21
22export default async function main(req: Request): Promise<Response> {
23 if (req.method === "POST") {
24 const formData = await req.formData();
6const key = "comments";
7
8export default async function main(req: Request): Promise<Response> {
9 if (req.method === "POST") {
10 // Handle comment submission
29`;
30
31export default async function main(req: Request): Promise<Response> {
32 // Fetch existing comments
33 let comments: string[] = await blob.getJSON(COMMENTS_KEY) || [];
2 * This val creates a simple comment box using an HTML form. When a comment is submitted,
3 * it stores the comment in a SQLite database and then displays all the comments.
4 * We use the built-in database functions from Val Town.
5 */
6
17
18// Handle requests
19export default async function main(req: Request): Promise<Response> {
20 const url = new URL(req.url);
21
21const app = new Hono();
22
23// Helper function to fetch all comments from the database
24async function fetchComments() {
25 const result = await sqlite.execute(`SELECT * FROM comments ORDER BY timestamp DESC`);
26 return result.rows;
14`);
15
16// Define the main function to handle HTTP requests.
17export default async function main(req: Request): Promise<Response> {
18 if (req.method === "POST") {
19 const formData = await req.formData();
1// Response with "Hello World" in crazy CSS and silly gradients
2export default async function(req: Request): Promise<Response> {
3 const htmlResponse = `
4 <!DOCTYPE html>
1// Response with "Hello World" in fancy HTML with silly gradients on every HTTP request
2export default async function(req: Request): Promise<Response> {
3 const html = `
4 <!DOCTYPE html>
1// Response with a silly HTML page with crazy CSS and gradients
2export default async function(req: Request): Promise<Response> {
3 const html = `
4 <html>

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month 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.