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=5&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"(868ms)

blob_adminREADME.md1 match

@danfishgold•Updated 13 hours ago
46- Collapsible/expandable object and array nodes
47- Syntax highlighting
48- Copy functionality
49- Edit mode with JSON validation
50- Error handling for invalid JSON

blob_adminutils.ts3 matches

@danfishgold•Updated 13 hours ago
45];
46
47export function isImage(path: string) {
48 return COMMON_IMAGE_EXTENSIONS.includes(path.split(".").pop());
49}
50
51export function isText(path: string) {
52 return COMMON_TEXT_EXTENSIONS.includes(path.split(".").pop());
53}
54
55export function isJSON(path: string, text?: string, size?: number): boolean {
56 // Check if file extension is .json
57 if (path.endsWith('.json')) {

blob_adminNotAuthorizedPage.tsx1 match

@danfishgold•Updated 13 hours ago
2import { Layout } from "./Layout.tsx";
3
4export function NotAuthorizedPage(
5 { username, email }: { username: string; email: string },
6) {

blob_adminNewPage.tsx1 match

@danfishgold•Updated 13 hours ago
2import { Layout } from "./Layout.tsx";
3
4export function NewPage(props) {
5 return (
6 <Layout>

blob_adminLoginPage.tsx1 match

@danfishgold•Updated 13 hours ago
2import { Layout } from "./Layout.tsx";
3
4export function LoginPage({ username }: { username: string }) {
5 return (
6 <Layout showLogout={false}>

blob_adminLayout.tsx1 match

@danfishgold•Updated 13 hours ago
1/** @jsxImportSource npm:hono/jsx */
2
3export function Layout({ children, showLogout = true }) {
4 return (
5 <html>

blob_adminBlobPage.tsx1 match

@danfishgold•Updated 13 hours ago
5type Blob = Awaited<ReturnType<typeof blob.list>>[number];
6
7export function BlobPage({ name, error, type, text, metadata }: {
8 name: string;
9 metadata?: Blob;
1export default async function(req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html lang="en">
212 <script>
213 // Cookie utilities
214 function setCookie(name, value, days = 30) {
215 const expires = new Date();
216 expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
218 }
219
220 function getCookie(name) {
221 const nameEQ = name + "=";
222 const ca = document.cookie.split(';');
230
231 // Load saved values
232 function loadSavedValues() {
233 // Load API key from cookie
234 const savedApiKey = getCookie('nvidia_api_key');
261
262 // Save current form values
263 function saveCurrentValues() {
264 const form = document.getElementById('apiForm');
265 const formData = new FormData(form);
298
299 // Make API request
300 async function makeApiRequest(requestData, apiKey) {
301 const response = await fetch('https://integrate.api.nvidia.com/v1/chat/completions', {
302 method: 'POST',
313
314 // Handle streaming response
315 async function handleStreamingResponse(response) {
316 const reader = response.body.getReader();
317 const decoder = new TextDecoder();
352
353 // Handle non-streaming response
354 async function handleNonStreamingResponse(response) {
355 const responseDiv = document.getElementById('responseContent');
356

untitled-7971main.ts1 match

@ashket3•Updated 15 hours ago
2const BASE_URL = "https://api.longcat.chat/openai";
3
4export default async function (req: Request): Promise<Response> {
5 const data = {
6 "model": "LongCat-Flash-Chat",

euro-aipparse.ts18 matches

@orionll•Updated 15 hours ago
96type SectionId = keyof typeof AD_SECTION_TITLES;
97
98function textClean(s?: string | null): string {
99 return (s ?? "")
100 .replace(/\u00AD/g, "") // soft hyphen
103}
104
105// function getProvider(doc: Document): AerodromeAD2["meta"]["provider"] {
106// const host = textClean(doc.querySelector("base")?.href || "");
107// const html = doc.documentElement.outerHTML;
112// return "OTHER";
113// }
114function getProvider(
115 doc: Document,
116 sourceUrl?: string,
127
128// Find all headings that look like “AD 2.x …”
129function findAllAdHeadings(doc: Document): HTMLElement[] {
130 const candidates = Array.from(doc.querySelectorAll("h1,h2,h3,h4,h5"));
131 return candidates.filter((h) => /AD[\s\h]*2\.\d+/.test(h.textContent || ""));
133
134// // Get the content nodes that belong to one AD 2.x heading, up to next AD 2.* heading
135// function collectSectionContent(start: HTMLElement): HTMLElement[] {
136// const content: HTMLElement[] = [];
137// let el = start.nextElementSibling as HTMLElement | null;
147// }
148
149function findSectionsInOnePass(doc: Document): AdSection[] {
150 const sections: AdSection[] = [];
151 const headingRegex = /^(?:[A-Z]{4}[\s\h]+)?AD[\s\h]*2\.(\d+)\b/i;
180}
181
182function collectSectionContent(
183 start: HTMLElement,
184 allHeadings: HTMLElement[],
194
195// Extract first table inside nodes; optionally all tables
196function findTables(nodes: HTMLElement[]): HTMLTableElement[] {
197 return nodes.flatMap((n) => Array.from(n.querySelectorAll("table")));
198}
199
200// Convert a table to a matrix of strings
201function tableToMatrix(table: HTMLTableElement): string[][] {
202 const rows = Array.from(table.querySelectorAll("tr"));
203 return rows.map((tr) =>
209
210// Generic: pick best header row (heuristic)
211function detectHeaderRow(
212 matrix: string[][],
213): { header: string[]; body: string[][] } {
227
228// Map body rows to objects by header
229function matrixToObjects(
230 header: string[],
231 body: string[][],
244
245// Key-value tables: try to read “label -> value” across rows
246function parseKeyValueMatrix(matrix: string[][]): Record<string, string> {
247 const out: Record<string, string> = {};
248 for (const row of matrix) {
264// Section-specific parsers
265
266function parseAD21(nodes: HTMLElement[]): AD21_Location | undefined {
267 // Often the page title or the first heading includes “EGBE — COVENTRY” etc.
268 // Try heading text, else look in AD 2.1 table.
293}
294
295function parseAD22(
296 nodes: HTMLElement[],
297 provider: AerodromeAD2["meta"]["provider"],
341}
342
343function parseAD212(
344 nodes: HTMLElement[],
345 provider: AerodromeAD2["meta"]["provider"],
408}
409
410function parseAD218(
411 nodes: HTMLElement[],
412 provider: AerodromeAD2["meta"]["provider"],
458}
459
460function parseAD224(nodes: HTMLElement[]): AD224_Charts | undefined {
461 const tables = findTables(nodes);
462 if (tables.length === 0) return undefined;
483}
484
485export async function parseAIP(
486 html: string,
487 sourceUrl?: string,

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.