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/$1?q=function&page=15&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 24676 results for "function"(2140ms)

fetchRssForSubcurrentindex.ts10 matches

@ashryanio•Updated 22 hours ago
76}
77
78// ===== CORE PROCESSING FUNCTIONS =====
79
80/**
83 * @returns {string} ISO 8601 formatted date string
84 */
85function parseDate(dateStr) {
86 if (!dateStr) return new Date().toISOString();
87 const date = new Date(dateStr);
94 * @returns {string} The preprocessed HTML content
95 */
96function preprocessHtmlSnippet(html) {
97 if (!html) return '';
98
139 * @returns {string|undefined} Image URL if found
140 */
141function extractImageUrl(item) {
142 // Try enclosure
143 const enclosure = item.enclosure;
183 * @returns {Object[]} Array of parsed feed entries
184 */
185function parseRssXml(xmlContent) {
186 try {
187 const parser = new XMLParser({
247 * @returns {Object} The processed entry
248 */
249function convertApiEntryToProcessedEntry(apiEntry, feed, fetchedAt) {
250 return {
251 title: apiEntry.title || '',
265 * @returns {Promise<string>} Raw XML content
266 */
267async function fetchFeedContent(url) {
268 const controller = new AbortController();
269 const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
297 * @returns {Promise<Object>} Processed feed result
298 */
299async function processSingleFeed(feed) {
300 const startTime = Date.now();
301 const fetchedAt = new Date().toISOString();
359 * @returns {Promise<ApiResponse>} Complete API response
360 */
361async function processMultipleFeeds(
362 feeds: Feed[],
363 options: ProcessingOptions = {}
445 * Processes RSS feeds and returns optimized, pre-processed entries
446 */
447export default async function (req) {
448 const corsHeaders = {
449 'Access-Control-Allow-Origin': '*',

personalShopperindex.tsx8 matches

@bgschiller•Updated 23 hours ago
13}
14
15function LoginPage(): JSX.Element {
16 return (
17 <div className="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
60}
61
62function Navbar({ userData }: { userData: UserData }): JSX.Element {
63 const handleLogout = async (): Promise<void> => {
64 try {
97}
98
99function DashboardCard({
100 title,
101 count,
133}
134
135function LocationSearch({ onLocationSelected }: { onLocationSelected?: () => void }): JSX.Element {
136 const [zipCode, setZipCode] = useState("");
137 const [locations, setLocations] = useState<Location[]>([]);
347}
348
349function CurrentLocationIndicator({
350 location,
351 onClick,
428}
429
430function ShoppingListCreator(): JSX.Element {
431 const [listText, setListText] = useState("");
432 const [isFocused, setIsFocused] = useState(false);
516}
517
518function Dashboard({ userData }: { userData: UserData }): JSX.Element {
519 const [guidanceCount, setGuidanceCount] = useState<string>("Loading...");
520 const [selectionsCount, setSelectionsCount] = useState<string>("Loading...");
658}
659
660function App(): JSX.Element {
661 const userData = (window as any).__USER_DATA__;
662 return userData ? <Dashboard userData={userData} /> : <LoginPage />;

personalShopperindex.ts1 match

@bgschiller•Updated 23 hours ago
51
52// Middleware to get current user from session
53async function getCurrentUser(c: any) {
54 const sessionId = await getSignedCookie(
55 c,

WordWarsindex.tsx1 match

@potluck•Updated 23 hours ago
6interface GameProps {}
7
8function Game({}: GameProps) {
9 const [gameState, setGameState] = useState<GameState | null>(null);
10 const [playerId, setPlayerId] = useState<string>('');

WordWarsindex.ts1 match

@potluck•Updated 1 day ago
14const games = new Map<string, GameState>();
15
16function createGame(gameId: string): GameState {
17 return {
18 id: gameId,

WordWarsutils.ts4 matches

@potluck•Updated 1 day ago
31};
32
33export function generateTiles(count: number = 30): Tile[] {
34 const tiles: Tile[] = [];
35 const letters: string[] = [];
58}
59
60export function isValidWord(word: string): boolean {
61 // Simple word validation - in a real game you'd use a dictionary API
62 // For now, just check it's at least 3 letters and contains only letters
64}
65
66export function canFormWord(word: string, availableTiles: Tile[]): { canForm: boolean; usedTiles: Tile[] } {
67 const wordLetters = word.toUpperCase().split('');
68 const flippedTiles = availableTiles.filter(tile => tile.isFlipped);
82}
83
84export function calculateWordScore(tiles: Tile[]): number {
85 return tiles.reduce((sum, tile) => sum + tile.points, 0);
86}

PresentationsNotice.tsx1 match

@wolf•Updated 1 day ago
9}
10
11export function Notice({ notice, confirm = false, confirmFunc, cancelFunc }: NoticeProps) {
12 if (!notice || notice.length === 0) return null;
13

PresentationsAddPresentation.tsx1 match

@wolf•Updated 1 day ago
9}
10
11export function AddPresentation({ numPresentations, onRefresh }: AddPresentationProps) {
12 const [titleInput, setTitleInput] = useState("");
13 const [presenterInput, setPresenterInput] = useState("");

PresentationsPresentationItem.tsx1 match

@wolf•Updated 1 day ago
10}
11
12export function PresentationItem({ presentation, editable, onRefresh }: PresentationItemProps) {
13 const [titleInput, setTitleInput] = useState(presentation.title);
14 const [presenterInput, setPresenterInput] = useState(presentation.presenter);

PresentationsTimer.tsx1 match

@wolf•Updated 1 day ago
3import { displayAsMinutes } from "../../shared/utils.ts";
4
5export function Timer() {
6 const [timerIsRunning, setTimerIsRunning] = useState(false);
7 const [startedAt, setStartedAt] = useState<number | null>(null);

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.