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/$%7Burl%7D?q=function&page=1&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 18135 results for "function"(830ms)

untitled-2604new-file-9513.tsx5 matches

@al0Updated 34 mins ago
7
8// Función para manejar solicitudes HTTP
9export default async function handler(req) {
10 // Configuración CORS para permitir solicitudes desde cualquier origen
11 const headers = {
74
75// Función para llamar a la API de OpenAI
76async function callOpenAI(apiKey, prompt, model, temperature, maxTokens) {
77 const url = 'https://api.openai.com/v1/chat/completions';
78
109
110// Función para llamar a la API de Claude (Anthropic)
111async function callClaude(apiKey, prompt, model, temperature, maxTokens) {
112 const url = 'https://api.anthropic.com/v1/messages';
113
146// UI para pruebas (solo para referencia, se debe implementar como una val separada en ValTown)
147// Esta función no se exporta para evitar conflictos con la exportación predeterminada
148function ui() {
149 return `
150 <!DOCTYPE html>
339 });
340
341 function addOption(select, value, text) {
342 const option = document.createElement('option');
343 option.value = value;

morningmailmain.tsx3 matches

@flymasterUpdated 34 mins ago
2import { email } from "https://esm.town/v/std/email";
3
4async function weather(): string {
5 var weather = await blob.getJSON(Deno.env.get("WEATHER_BLOB"));
6 weather = weather.forecast;
9}
10
11async function wikitext(): string {
12 const randomArticle = await fetch(
13 "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro&explaintext&redirects=1&generator=random&formatversion=2&grnnamespace=0&grnlimit=3",
23}
24
25export default async function(interval: Interval) {
26 var emailText = "";
27 emailText = emailText + await weather();

testPondiversedeleteCreation.tsx1 match

@argmnUpdated 55 mins ago
4import { TABLE_NAME } from "./updateTable";
5
6export default async function(req: Request): Promise<Response> {
7 // body contains:
8 // - id (number)

testPondiverseaddCreation.tsx1 match

@argmnUpdated 56 mins ago
4import { TABLE_NAME } from "./updateTable";
5
6export default async function(req: Request): Promise<Response> {
7 // body contains:
8 // - title (string)

testPondiverseupdateTable.tsx1 match

@argmnUpdated 59 mins ago
2
3export const TABLE_NAME = "pondiverse_creations_v5";
4export default async function(req: Request): Promise<Response> {
5 await sqlite.execute(
6 `CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
18const lruCache = new LRUCache(ttlOptions);
19
20export default async function(req: Request): Promise<Response> {
21 const searchParams = new URL(req.url).searchParams;
22 const discussionId = searchParams.get("discussion");
79}
80
81async function getDiscussionPosts(discussionId: string): Promise<PostT[]> {
82 // Used to get the list of post id's for the discussion.
83 const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
117
118// This takes an array and chunks it.
119function chunkArray<T>(array: T[], chunkSize: number): T[][] {
120 const chunks: T[][] = [];
121 for (let i = 0; i < array.length; i += chunkSize) {

testOpenAIblah.tx1 match

@stevekrouseUpdated 1 hour ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

glifTestmain.tsx1 match

@jonboUpdated 1 hour ago
1export default async function(req: Request): Promise<Response> {
2 return Response.json({
3 image_url: "https://jon.bo/IMG_9387.png",

testPondiversegetCreation.tsx1 match

@argmnUpdated 1 hour ago
4import { TABLE_NAME } from "./updateTable";
5
6export default async function(req: Request): Promise<Response> {
7 const url = new URL(req.url);
8 const id = url.searchParams.get("id");

slack-prgithub-pr-inherit-labels.ts4 matches

@charmaineUpdated 1 hour ago
48
49// Main handler for HTTP requests
50export default async function(req: Request): Promise<Response> {
51 console.log("🔍 Request received:", req.method, "URL:", req.url);
52 console.log("🔍 Headers:", JSON.stringify(Object.fromEntries([...req.headers])));
166
167// Extract issue numbers from PR body
168function extractIssueNumbers(body: string): number[] {
169 // Match common issue linking keywords
170 const patterns = [
191
192// Fetch issue details
193async function fetchIssue(repo: string, issueNumber: number): Promise<GitHubIssue> {
194 const token = Deno.env.get("GITHUB_TOKEN");
195
228
229// Add labels to PR
230async function addLabelsToPR(repo: string, prNumber: number, labels: string[]) {
231 const token = Deno.env.get("GITHUB_TOKEN");
232

getFileEmail4 file matches

@shouserUpdated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",