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=12&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 24489 results for "function"(2163ms)

Townieauth.ts1 match

@chadparker•Updated 7 hours ago
5 * Returns null if authentication is successful, or a Response if it fails
6 */
7export async function basicAuthMiddleware(req: Request): Promise<Response | null> {
8 const realm = "Usage Dashboard";
9 const unauthorizedResponse = new Response("Unauthorized", {

TownieApp.tsx1 match

@chadparker•Updated 7 hours ago
17});
18
19export function App() {
20 const [audio, setAudio] = useLocalStorage("AUDIO", false);
21 const user = useUser();

america-chronmain.tsx1 match

@katendeglory•Updated 7 hours ago
3const url = "https://voxdeitv-411l.onrender.com/";
4
5export default async function(req: Request): Promise<Response> {
6 try {
7 https

africa-chronmain.tsx1 match

@katendeglory•Updated 7 hours ago
3const url = "https://chron-waker.onrender.com";
4
5export default async function(req: Request): Promise<Response> {
6 try {
7 https

Okmigrations.ts6 matches

@oknareshmeena•Updated 8 hours ago
16 * Initialize all database tables
17 */
18export async function initializeDatabase(): Promise<void> {
19 await createParentsTable();
20 await createDevicesTable();
26 * Create parents table
27 */
28async function createParentsTable(): Promise<void> {
29 await sqlite.execute(`
30 CREATE TABLE IF NOT EXISTS ${TABLES.PARENTS} (
43 * Create devices table
44 */
45async function createDevicesTable(): Promise<void> {
46 await sqlite.execute(`
47 CREATE TABLE IF NOT EXISTS ${TABLES.DEVICES} (
66 * Create recording sessions table
67 */
68async function createSessionsTable(): Promise<void> {
69 await sqlite.execute(`
70 CREATE TABLE IF NOT EXISTS ${TABLES.SESSIONS} (
92 * Create uploads table for tracking Google Drive uploads
93 */
94async function createUploadsTable(): Promise<void> {
95 await sqlite.execute(`
96 CREATE TABLE IF NOT EXISTS ${TABLES.UPLOADS} (
114 * Create indexes for better performance
115 */
116export async function createIndexes(): Promise<void> {
117 const indexes = [
118 `CREATE INDEX IF NOT EXISTS idx_devices_parent_id ON ${TABLES.DEVICES}(parent_id)`,

Okutils.ts12 matches

@oknareshmeena•Updated 8 hours ago
1// Shared utility functions
2
3import type { RecordingDuration, ApiResponse } from './types.ts';
6 * Generate a unique ID for sessions, devices, etc.
7 */
8export function generateId(): string {
9 return crypto.randomUUID();
10}
13 * Format duration for display
14 */
15export function formatDuration(duration: RecordingDuration): string {
16 switch (duration) {
17 case '10min':
29 * Convert duration to milliseconds
30 */
31export function durationToMs(duration: RecordingDuration): number {
32 switch (duration) {
33 case '10min':
45 * Format timestamp for display
46 */
47export function formatTimestamp(date: Date): string {
48 return new Intl.DateTimeFormat('en-US', {
49 year: 'numeric',
59 * Check if device is online (last seen within 5 minutes)
60 */
61export function isDeviceOnline(lastSeen: Date): boolean {
62 const fiveMinutesAgo = new Date(Date.now() - 5 * 60 * 1000);
63 return lastSeen > fiveMinutesAgo;
67 * Create a standardized API response
68 */
69export function createApiResponse<T>(
70 success: boolean,
71 data?: T,
84 * Validate recording duration
85 */
86export function isValidDuration(duration: string): duration is RecordingDuration {
87 return ['10min', '40min', '24hr'].includes(duration);
88}
91 * Generate a secure device ID based on browser fingerprint
92 */
93export function generateDeviceId(): string {
94 const canvas = document.createElement('canvas');
95 const ctx = canvas.getContext('2d');
108 ].join('|');
109
110 // Simple hash function
111 let hash = 0;
112 for (let i = 0; i < fingerprint.length; i++) {
122 * Check if browser supports required features
123 */
124export function checkBrowserSupport(): { supported: boolean; missing: string[] } {
125 const missing: string[] = [];
126
150 * Request necessary permissions
151 */
152export async function requestPermissions(): Promise<{ granted: boolean; errors: string[] }> {
153 const errors: string[] = [];
154

OkREADME.md1 match

@oknareshmeena•Updated 8 hours ago
422. Configure parent authentication
433. Install the child interface on the target device
444. Test recording and upload functionality
45
46## Environment Variables

untitled-7533ESM.tsx1 match

@StRoMoGgY•Updated 9 hours ago
14};
15
16export default function HustlersToolkitApp() {
17 const [isLoggedIn, setIsLoggedIn] = useState(false);
18 const [user, setUser] = useState({

openvizindex.ts1 match

@dcm31•Updated 9 hours ago
1export default async function(req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html lang="en">

html-experimentsadaptive-analog-clock.ts1 match

@chadparker•Updated 10 hours ago
1export default async function(req: Request): Promise<Response> {
2 try {
3 // Fetch the HTML from the specified URL

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.