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=3&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 18147 results for "function"(1223ms)

untitled-2604new-file-9513.tsx12 matches

@al0•Updated 3 hours ago
3// Fecha: 05 de mayo de 2025
4
5export default async function handler(req) {
6 // ConfiguraciĂłn CORS para permitir solicitudes desde cualquier origen
7 const headers = {
112
113// FunciĂłn para llamar a la API de OpenAI
114async function callOpenAI(apiKey, prompt, model, temperature, maxTokens) {
115 const url = 'https://api.openai.com/v1/chat/completions';
116
171
172// FunciĂłn para llamar a la API de Claude (Anthropic)
173async function callClaude(apiKey, prompt, model, temperature, maxTokens) {
174 const url = 'https://api.anthropic.com/v1/messages';
175
237
238// FunciĂłn para renderizar la interfaz de usuario
239function renderUI() {
240 return `
241 <!DOCTYPE html>
398 const tempSlider = document.getElementById('temperature');
399 const tempValue = document.getElementById('temperatureValue');
400 tempSlider.addEventListener('input', function() {
401 tempValue.textContent = tempSlider.value;
402 });
404 // Cambiar entre pestañas
405 const tabs = document.querySelectorAll('.tab');
406 tabs.forEach(function(tab) {
407 tab.addEventListener('click', function() {
408 const tabName = tab.getAttribute('data-tab');
409
410 // Desactivar todas las pestañas
411 document.querySelectorAll('.tab').forEach(function(t) {
412 t.classList.remove('active');
413 });
414 document.querySelectorAll('.tab-content').forEach(function(c) {
415 c.classList.remove('active');
416 });
433 const modelSelect = document.getElementById('model');
434
435 providerSelect.addEventListener('change', function() {
436 const provider = providerSelect.value;
437
451 });
452
453 function addOption(select, value, text) {
454 const option = document.createElement('option');
455 option.value = value;
463 const rawResult = document.getElementById('rawResult');
464
465 submitBtn.addEventListener('click', async function() {
466 const provider = document.getElementById('provider').value;
467 const apiKey = document.getElementById('apiKey').value;

testPondiversedeleteCreation1 match

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

morningmailmain.tsx4 matches

@flymaster•Updated 3 hours ago
2import { email } from "https://esm.town/v/std/email";
3
4function links(): string {
5 var links = "- [Gisnep](https://gisnep.com)\n";
6 links = links + "- [Gin](https://cardgames.io/ginrummy)\n";
10}
11
12async function weather(): string {
13 var weather = await blob.getJSON(Deno.env.get("WEATHER_BLOB"));
14 weather = weather.forecast;
17}
18
19async function wikitext(): string {
20 const randomArticle = await fetch(
21 "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",
31}
32
33export default async function(interval: Interval) {
34 var emailText = "";
35 emailText = emailText + await weather();

testPondiversemain1 match

@argmn•Updated 3 hours ago
6import updateTable from "./updateTable";
7
8export default async function(req: Request): Promise<Response> {
9 let url = new URL(req.url);
10 const path = url.pathname.toLowerCase();

testPondiversegetCreationImage1 match

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

LEDStrain-Discussion-To-PlainTextapp.tsx3 matches

@tyler71•Updated 4 hours ago
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

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

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

@charmaine•Updated 4 hours 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

slack-prgithub-pr-auto-assign.ts2 matches

@charmaine•Updated 4 hours ago
35
36// Main handler for HTTP requests
37export default async function(req: Request): Promise<Response> {
38 console.log("🔍 Request received:", req.method, "URL:", req.url);
39 console.log("🔍 Headers:", JSON.stringify(Object.fromEntries([...req.headers])));
141
142// Assign a user to a PR
143async function assignUserToPR(repo: string, prNumber: number, username: string) {
144 const token = Deno.env.get("GITHUB_TOKEN");
145

slack-prgithub-pr-title-prefix.ts3 matches

@charmaine•Updated 5 hours ago
31
32// Main handler for HTTP requests
33export default async function(req: Request): Promise<Response> {
34 console.log("🔍 Request received:", req.method, "URL:", req.url);
35 console.log("🔍 Headers:", JSON.stringify(Object.fromEntries([...req.headers])));
128
129// Extract issue numbers from PR body
130function extractIssueNumbers(body: string): number[] {
131 // Match common issue linking keywords
132 const patterns = [
153
154// Update PR title
155async function updatePRTitle(repo: string, prNumber: number, newTitle: string) {
156 const token = Deno.env.get("GITHUB_TOKEN");
157

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
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": "*",