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//%22?q=function&page=6&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 40461 results for "function"(755ms)

mcp-registry

mcp-registrymain.tsx2 matches

@cameronpak•Updated 16 hours ago
266 <script>
267 {`
268 function showServerDetails(serverId, serverName) {
269 alert(\`Server: \${serverName}\\nID: \${serverId}\\n\\nDetailed view coming soon!\`);
270 }
496let maxPageReached = 1;
497
498function getPageFromCursor(cursor: string | null): number {
499 if (!cursor) return 1;
500 // Find the page number for this cursor

euro-aipmain.ts1 match

@orionll•Updated 16 hours ago
2import { parseAIP } from "./parse.ts";
3
4export default async function (req: Request): Promise<Response> {
5 const data = await getAirportsIndex();
6

Letterboxd_Blueskymain.ts3 matches

@Petezarustica•Updated 16 hours ago
18};
19
20export default async function main() {
21 // 1) Get credentials from env
22 const handle = Deno.env.get("BLUESKY_HANDLE");
88// Try to reduce typical Letterboxd RSS titles to just the film title.
89// Example input: "vonrunte watched Inception (2010) ★★★★"
90function cleanFeedTitle(raw: string): string {
91 const watchedIdx = raw.toLowerCase().indexOf("watched ");
92 let s = watchedIdx >= 0 ? raw.slice(watchedIdx + "watched ".length) : raw;
104
105// Ensure we don't exceed Bluesky's 300-char limit
106function trimToLimit(text: string, limit: number): string {
107 if (text.length <= limit) return text;
108 // Keep the link intact if present

euro-aipairports.ts7 matches

@orionll•Updated 16 hours ago
6import { Cycle } from "npm:airac-cc";
7
8function getCurrentCycle() {
9 return Cycle.fromDate(new Date());
10}
11
12function getEffectiveDate(cycle): string {
13 return cycle.effectiveStart.toISOString().slice(0, 10);
14}
15
16function getAirportsNATS(cycleStart: string): string {
17 const path = new URL(
18 `https://www.aurora.nats.co.uk/htmlAIP/Publications/${cycleStart}-AIRAC/html/eAIP/EG-AD-0.1-en-GB.html`,
21}
22
23async function getAirportsAvinor(cycleStart: string): string {
24 const response = await fetch("https://aim-prod.avinor.no/no/AIP/");
25 const path = new URL(
30}
31
32function getIdentifierFromLink(link: string): string | null {
33 if (!link) {
34 return null;
42}
43
44async function getAirports(aip) {
45 const respose = await fetch(aip);
46 const html = await respose.text();
59}
60
61export async function getAirportsIndex() {
62 const cycle = getCurrentCycle();
63 const effective = getEffectiveDate(cycle);

test_jsmain.tsx3 matches

@wlya•Updated 18 hours ago
92
93 window.counter = 0;
94 function loadImage(){
95 window.counter++;
96 if(window.counter > 6 ){
105 if (file) {
106 const reader = new FileReader();
107 reader.onload = function(e) {
108 preview.src = e.target.result; // 设置 img 的 src
109 }
112 });
113
114function updateTime() {
115 const now = new Date();
116 const year = now.getFullYear();

Parse-my-PDFmain.tsx4 matches

@aibotcommander•Updated 19 hours ago
3 * Returns a response to the user's query
4 */
5async function getResponse(req: Query, send: SendEventFn) {
6 send("meta", { content_type: "text/markdown" });
7 const lastMessage = req.query.at(-1);
26 * Returns your bot's settings
27 */
28async function getBotSettings(): Promise<BotSettings> {
29 return {
30 allow_attachments: true,
89) => void;
90
91function encodeEvent(event: string, data: any = {}) {
92 return new TextEncoder().encode(
93 `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`,
95}
96
97export default async function (req: Request): Promise<Response> {
98 const reqBody = await req.json().catch((e) => {
99 console.error("body parse error", e);

croneinteractionRouter.ts1 match

@jrmann100•Updated 19 hours ago
13 * Route the Discord interaction to the appropriate handler
14 */
15export async function handleInteraction(c: Context) {
16 const req = await c.req.json();
17

GLM-4-5-Omnimain.tsx15 matches

@aibotcommander•Updated 20 hours ago
295}
296
297function isShortInput(
298 messages: Array<{ role: string; content: string }>,
299): boolean {
302}
303
304function isMediumInput(
305 messages: Array<{ role: string; content: string }>,
306): boolean {
309}
310
311function isGreeting(message: string): boolean {
312 if (!message) return false;
313
334}
335
336function getStandardResponse(message: string): string | null {
337 const cleanMsg = message.toLowerCase().trim().replace(/[.!?]+$/, "");
338
343 "I'm an omni-capable AI assistant powered by multiple advanced language models including DeepSeek, Llama-4, and others.",
344 "how are you":
345 "I'm functioning optimally and ready to help with your questions and file processing needs.",
346 "what can you do":
347 "I can analyze text, images, videos, and documents. I can also engage in conversations, answer questions, write code, and help with various tasks.",
357}
358
359async function processAttachments(
360 attachments: FileAttachment[],
361): Promise<string> {
381}
382
383async function createVisionMessage(
384 content: string,
385 attachments: FileAttachment[],
416}
417
418async function makeRequest(
419 config: ModelConfig,
420 messages: any[],
454}
455
456async function processStreamOptimized(
457 response: Response,
458 send: SendEventFn,
498}
499
500async function requestWithTimeout(
501 promise: Promise<Response>,
502 timeoutMs: number = 8000,
509}
510
511function calculateCosts(
512 query: any[],
513): { inputCost: number; estimatedOutputCost: number } {
543}
544
545async function getResponse(req: Query, send: SendEventFn) {
546 send("meta", { content_type: "text/markdown" });
547
640}
641
642async function getBotSettings(): Promise<BotSettings> {
643 const rateCard = "| Type | Price |\n" +
644 "|------|------|\n" +
706) => void;
707
708function encodeEvent(event: string, data: any = {}) {
709 return new TextEncoder().encode(
710 `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`,
712}
713
714export default async function (req: Request): Promise<Response> {
715 const reqBody = await req.json().catch((e) => {
716 console.error("Body parse error:", e);

untitled-7197main.ts1 match

@sammy•Updated 20 hours ago
1export default async function (req: Request): Promise<Response> {
2 // Ensure the request is a POST
3 if (req.method !== "POST") {

openai-usagemain.ts1 match

@nbbaier•Updated 22 hours ago
28 * Fetch organization costs for a given time period
29 */
30export async function fetchOrganizationCosts(
31 startTime: number,
32 days: number,

ratelimit4 file matches

@unkey•Updated 1 month ago
Rate limit your serverless functions

discordWebhook2 file matches

@stevekrouse•Updated 2 months ago
Helper function to send Discord messages
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.