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=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 30212 results for "function"(1489ms)

tuempresaValidationCatalogGemini.tsx1 match

@arequipe•Updated 44 mins ago
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
5export default async function validateCartaPorteData(req: Request): Promise<Response> {
6 const AIRTABLE_API_KEY = Deno.env.get("AIRTABLE_API_KEY")!;
7 const AIRTABLE_BASE_ID = Deno.env.get("AIRTABLE_BASE_ID")!;

thehost-mapboxscript.js16 matches

@ncf•Updated 56 mins ago
1let map;
2document.addEventListener("DOMContentLoaded", function() {
3 mapboxgl.accessToken = "pk.eyJ1IjoidGhlaG9zdCIsImEiOiJjbWEybmh6aWYwYXY3MnFyM2h3ZXhydWp4In0.pkEiJs8EOR9t1ZFCzfWAtQ";
4 map = new mapboxgl.Map({
18 map.addControl(new mapboxgl.NavigationControl({ showCompass: false }), "top-right");
19
20 map.on("load", function() {
21 // Ajout de l'icône custom PNG blanc (hébergée sur Webflow, doit être blanc pur sur fond transparent)
22 map.loadImage(
58 });
59
60 map.on("moveend", function() {
61 if (window.filterListByMapView) window.filterListByMapView();
62 });
63 map.on("zoomend", function() {
64 if (window.filterListByMapView) window.filterListByMapView();
65 });
76
77// Récupère les points dynamiques depuis le DOM (Webflow)
78function initializePoints() {
79 const locationItems = document.querySelectorAll("[points-mapbox]");
80 mapLocations.features = [];
127// Cette fonction remplace addMapPoints et addMapLayerEvents
128// =========================
129function updateMarkers(features) {
130 // 1. Supprimer les marqueurs existants
131 currentMarkers.forEach((marker) => marker.remove());
133
134 // Détection du mode tactile (tablette/mobile)
135 function isTouchDevice() {
136 return "ontouchstart" in window || navigator.maxTouchPoints > 0;
137 }
239// addMapLayerEvents() - SUPPRIMÉ
240
241function filterListByMap() {
242 const bounds = map.getBounds();
243 const sw = bounds.getSouthWest();
261}
262
263function getUrlParams() {
264 const params = {};
265 window.location.search.substring(1).split("&").forEach(function(part) {
266 if (!part) return;
267 const item = part.split("=");
271}
272
273window.updateMapPointsFromVisibleCards = function() {
274 const visibleItems = Array.from(document.querySelectorAll("[points-mapbox]")).filter(item =>
275 item.style.display !== "none"
336]);
337
338window.filterListByMapView = function() {
339 if (!map) return;
340 const bounds = map.getBounds();
376// Ajout : Hover sur la liste synchronisé avec la carte (MODIFIÉ)
377// =========================
378function bindListHoverToMapbox() {
379 document.querySelectorAll("[points-mapbox]").forEach((item) => {
380 item.onmouseenter = null;
389 if (!markerEl) return;
390
391 item.onmouseenter = function() {
392 const path = markerEl.querySelector(".marker-path");
393 if (path) path.style.fill = "#F7F3E6";
394 };
395 item.onmouseleave = function() {
396 const path = markerEl.querySelector(".marker-path");
397 if (path) path.style.fill = "black";
403// Appel initial après chargement de la carte et des points
404if (document.readyState === "loading") {
405 document.addEventListener("DOMContentLoaded", function() {
406 if (window.bindListHoverToMapbox) window.bindListHoverToMapbox();
407 });

Louapi_scheduler_trigger.tsx4 matches

@jeffvincent•Updated 1 hour ago
4import { LouLineupScheduler } from "./daily_lineup_scheduler.tsx";
5
6export default async function(req: Request): Promise<Response> {
7 console.log("Manual scheduler trigger API called");
8
54}
55
56async function handleGetRequest(url: URL): Promise<Response> {
57 const path = url.pathname;
58
160}
161
162async function handlePostRequest(req: Request): Promise<Response> {
163 const url = new URL(req.url);
164 const path = url.pathname;
214}
215
216function createErrorResponse(title: string, message: string, status: number): Response {
217 return new Response(
218 JSON.stringify({

log-media-request-headersmain.tsx1 match

@eeeps•Updated 1 hour ago
1export default async function(req: Request): Promise<Response> {
2 console.log(req.headers);
3 return new Promise((resolve, reject) => {

html2svgmain.tsx3 matches

@g•Updated 1 hour ago
8import { Hono } from "npm:hono";
9
10function html() {
11 /*
12 <!DOCTYPE html>
58}
59
60function css() {
61 /*
62 body {
138}
139
140function js() {
141 /*
142 document.addEventListener("DOMContentLoaded", () => {

OptimismTrackerindex.html9 matches

@dcm31•Updated 1 hour ago
288 const probabilityValue = document.getElementById('probabilityValue');
289
290 probabilitySlider.addEventListener('input', function() {
291 probabilityValue.textContent = this.value;
292 });
299
300 // Data storage
301 function getPredictions() {
302 return JSON.parse(localStorage.getItem('predictions') || '[]');
303 }
304
305 function savePredictions(predictions) {
306 localStorage.setItem('predictions', JSON.stringify(predictions));
307 }
308
309 function addPrediction() {
310 const question = document.getElementById('question').value.trim();
311 const probability = parseInt(document.getElementById('probability').value);
339 }
340
341 function resolvePrediction(id, outcome) {
342 const predictions = getPredictions();
343 const prediction = predictions.find(p => p.id === id);
351 }
352
353 function updateDisplay() {
354 const predictions = getPredictions();
355 const active = predictions.filter(p => !p.resolved);
361 }
362
363 function displayActivePredictions(predictions) {
364 const container = document.getElementById('activePredictions');
365
384 }
385
386 function displayResolvedPredictions(predictions) {
387 const container = document.getElementById('resolvedPredictions');
388
406 }
407
408 function updateCalibration(resolvedPredictions) {
409 if (resolvedPredictions.length < 3) {
410 document.getElementById('calibrationSection').classList.add('hidden');

tuempresaValidationCatalogGrok.tsx2 matches

@arequipe•Updated 2 hours ago
11};
12
13async function fetchRecord(table: string, recordId: string) {
14 const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${table}/${recordId}`, {
15 headers: airtableHeaders,
19}
20
21export async function validateRecord(req: Request): Promise<Response> {
22 try {
23 const recordId = new URL(req.url).searchParams.get("recordId");

dashboardmain.tsx1 match

@rayyan•Updated 2 hours ago
1export default async function (interval: Interval) {
2
3}

vt-testsemailAnalyzer.http.tsx2 matches

@dervondenbergen•Updated 3 hours ago
1import Anthropic from "https://esm.sh/@anthropic-ai/sdk@0.24.3";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "GET") {
5 return new Response("Method not allowed", { status: 405 });
117}
118
119function isValidEmail(email: string): boolean {
120 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
121 return emailRegex.test(email);

mcp-servermain.ts13 matches

@joshbeckman•Updated 3 hours ago
32};
33
34function postFilter(post: Post) {
35 return post.type == "post" || post.type == "page";
36}
37
38function buildTagsIndex(tags: Array<Tag>) {
39 return lunr(function() {
40 this.ref("id");
41 this.field("name");
50 });
51}
52function search(input: string, index: lunr.Index, searchData: Record<string, Post>) {
53 let results = index.search(input);
54
55 if ((results.length == 0) && (input.length > 2)) {
56 let tokens = lunr.tokenizer(input).filter(function(token, i) {
57 return token.str.length < 20;
58 });
59
60 if (tokens.length > 0) {
61 results = index.query(function(query) {
62 query.term(tokens, {
63 editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
90}
91
92function searchTags(input: string, index: lunr.Index, tags: Array<Tag>) {
93 let results = index.search(input);
94
95 if ((results.length == 0) && (input.length > 2)) {
96 let tokens = lunr.tokenizer(input).filter(function(token, i) {
97 return token.str.length < 20;
98 });
99
100 if (tokens.length > 0) {
101 results = index.query(function(query) {
102 query.term(tokens, {
103 editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
116 });
117}
118function formatPage(page: Post) {
119 return [
120 `# [${page.title}](${SITE_URL + page.url})`,
135}
136
137function extractPostCategory(post: Post) {
138 if (post.type == "page") {
139 return "page";
160 * Uses a cached instance if available
161 */
162async function setupMcpServer(): Promise<McpServer> {
163 // Return cached instance if available
164 if (mcpServerInstance) {
498
499/**
500 * Val.town handler function for HTTP requests
501 * This will be exposed as a Val.town HTTP endpoint
502 */
tuna

tuna9 file matches

@jxnblk•Updated 6 days ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.