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/$%7Bart_info.art.src%7D?q=function&page=1615&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 19302 results for "function"(2906ms)

1// This val will respond with "Hello, world!" to any HTTP request
2
3export default async function (req: Request): Promise<Response> {
4 return new Response("Hello, world!");
5}
1// This val will simply respond with "Hello, World!"
2export default async function(req: Request): Promise<Response> {
3 return new Response("Hello, World!");
4}
1// This val responds with "Hello, world!"
2export default async function(req: Request): Promise<Response> {
3 return new Response("Hello, world!");
4}
1// This val will respond with "Hello World" to any incoming HTTP request
2
3export default async function(req: Request): Promise<Response> {
4 return new Response("Hello World");
5}

cheerioScrapermain.tsx1 match

@damidina•Updated 10 months ago
4console.log(urls);
5
6export default async function scrapeWebsite(url: string) {
7 const response = await fetch(url);
8 const body = await response.text();

stringInferExamplemain.tsx1 match

@yawnxyz•Updated 10 months ago
2
3// selects from xml selectors like <json></json> gets better results
4export function selectFromString(str, selector = "json", returnAll = false) {
5 const regex = new RegExp(`<${selector}>([\\s\\S]*?)</${selector}>`, 'gm');
6 const matches = [...str.matchAll(regex)].map(match => match[1]);

hackerNewsRAGmain.tsx1 match

@cenktekin•Updated 10 months ago
54
55// Render streaming markdown
56export default async function handler(req: Request): Promise<Response> {
57 let { readable, writable } = new TransformStream();
58 let writer = writable.getWriter();

updateTidbytWorkoutIntervalmain.tsx1 match

@andreterron•Updated 10 months ago
1import { updateTidbytWorkout } from "https://esm.town/v/andreterron/updateTidbytWorkout";
2
3export default async function updateTidbytWorkoutInterval() {
4 await updateTidbytWorkout();
5}

jumpchain_infositemain.tsx1 match

@willthereader•Updated 10 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

hackerNewsRAGmain.tsx1 match

@paulhoule•Updated 10 months ago
59
60// Render streaming markdown
61export default async function handler(req: Request): Promise<Response> {
62 let { readable, writable } = new TransformStream();
63 let writer = writable.getWriter();

getFileEmail4 file matches

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

tuna8 file matches

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