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/$2?q=function&page=2&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 23725 results for "function"(563ms)

MCPutils.ts2 matches

@c15r•Updated 1 hour ago
33} as const;
34
35export function validateRequired(params: any, required: string[]): void {
36 for (const field of required) {
37 if (params[field] === undefined || params[field] === null) {
44}
45
46export function sanitizeKey(key: string): string {
47 // Ensure blob keys are safe
48 return key.replace(/[^a-zA-Z0-9_\-\.\/]/g, '_');

sqliteExplorerApp2README.md1 match

@ryi•Updated 2 hours ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37

wikipediaindex.ts2 matches

@flymaster•Updated 2 hours ago
11}
12
13async function fetchRandomWikipediaArticle(): Promise<{ title: string; extract: string; pageId: number } | null> {
14 try {
15 const response = await fetch('https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&meta=&generator=random&formatversion=2&exsentences=1&explaintext=1&grnnamespace=0');
37}
38
39export default async function(req: Request): Promise<Response> {
40 const article = await fetchRandomWikipediaArticle();
41

wikipediaREADME.md2 matches

@flymaster•Updated 2 hours ago
11- **World Icon**: Clean SVG world icon that links to the full Wikipedia article
12- **Responsive**: Works well on desktop and mobile devices
13- **Error Handling**: Graceful error handling with retry functionality
14- **Fast Loading**: No client-side API calls means instant content display
15
39- **No JavaScript**: Completely static HTML with CSS-only animations
40- **Wikipedia API Integration**: Fetches random articles using the Wikipedia API on the server
41- **Error Handling**: Proper error states with retry functionality
42- **Clean Architecture**: Separation of data fetching and HTML generation
43- **Performance**: Fast loading since no client-side API calls are needed

dateme-2faq1 match

@stevekrouse•Updated 3 hours ago
4let linkClass = "text-sky-600 hover:text-sky-500";
5
6export default function FAQ(c) {
7 const userEmail = c.req.header("X-LastLogin-Email");
8

dateme-2browse4 matches

@stevekrouse•Updated 3 hours ago
4import Layout from "./layout";
5
6function absoluteURL(url) {
7 if (url.startsWith("http://") || url.startsWith("https://"))
8 return url;
24let linkClass = "text-sky-600 hover:text-sky-500";
25
26function httpsIfy(url: string) {
27 if (!url.startsWith("http://") && !url.startsWith("https://")) {
28 return `https://${url}`;
31}
32
33function renderCell(header, row) {
34 let data = row[header];
35 if (header === "Name") {
45}
46
47export default async function Browse(c) {
48 const userEmail = c.req.header("X-LastLogin-Email");
49 const url = new URL(c.req.url);

dateme-2home1 match

@stevekrouse•Updated 3 hours ago
3import Layout from "./layout";
4
5export default function Home(c) {
6 const userEmail = c.req.header("X-LastLogin-Email");
7

dateme-2join2 matches

@stevekrouse•Updated 3 hours ago
45
46// Get existing profile for a user
47async function getUserProfile(userEmail: string) {
48 try {
49 const { columns, rows } = await sqlite.execute({
384};
385// Database migration to add UserEmail column if it doesn't exist
386async function ensureUserEmailColumn() {
387 try {
388 // Try to add the UserEmail column - this will fail if it already exists, which is fine

dateme-2layout1 match

@stevekrouse•Updated 3 hours ago
6const thisURL = parseProject(import.meta.url).links.self.project;
7
8export default function({ activeTab, children, userEmail }: PropsWithChildren<{ activeTab: string; userEmail?: string }>) {
9 return (
10 <html>

dateme-2rss1 match

@stevekrouse•Updated 3 hours ago
3import { zip } from "npm:lodash-es";
4
5export async function rss(req: Request) {
6 let { columns, rows } = await sqlite.execute(`select * from datemedocs order by LastUpdated desc limit 20`);
7 const profiles = rows.map(row =>

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
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.