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/$%7Bsuccess?q=function&page=117&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 21024 results for "function"(1367ms)

AppkySearchPage.tsx1 match

@OssyNachโ€ขUpdated 3 days ago
8}
9
10export function SearchPage({ onViewPackage }: SearchPageProps) {
11 // Search form state
12 const [destination, setDestination] = useState('');

AppkyPackageCard.tsx1 match

@OssyNachโ€ขUpdated 3 days ago
9}
10
11export function PackageCard({ travelPackage, onClick }: PackageCardProps) {
12 const {
13 title,

AppkyDashboard.tsx1 match

@OssyNachโ€ขUpdated 3 days ago
11}
12
13export function Dashboard({ featuredPackages, onViewPackage, onSearch }: DashboardProps) {
14 const [destination, setDestination] = useState('');
15 const [startDate, setStartDate] = useState('');

AppkyHeader.tsx1 match

@OssyNachโ€ขUpdated 3 days ago
9}
10
11export function Header({ user, onNavigate, onLogout }: HeaderProps) {
12 const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
13

Appkyindex.tsx1 match

@OssyNachโ€ขUpdated 3 days ago
24
25// App component
26export function App({ initialData }: AppProps) {
27 // State for current page/route
28 const [currentPage, setCurrentPage] = useState('home');

Appkyutils.ts9 matches

@OssyNachโ€ขUpdated 3 days ago
2
3// Format currency with proper symbol and decimal places
4export function formatCurrency(amount: number, currency = "USD"): string {
5 const currencySymbols: Record<string, string> = {
6 USD: "$",
24
25// Format date to a user-friendly string
26export function formatDate(dateString: string): string {
27 const date = new Date(dateString);
28 return date.toLocaleDateString("en-US", {
34
35// Calculate the number of days between two dates
36export function calculateDays(startDate: string, endDate: string): number {
37 const start = new Date(startDate);
38 const end = new Date(endDate);
42
43// Parse JSON string to UserPreferences object
44export function parsePreferences(preferencesJson: string | undefined): UserPreferences | undefined {
45 if (!preferencesJson) return undefined;
46
54
55// Stringify UserPreferences object to JSON string
56export function stringifyPreferences(preferences: UserPreferences | undefined): string | undefined {
57 if (!preferences) return undefined;
58
66
67// Generate a random transaction ID for payment simulation
68export function generateTransactionId(): string {
69 return `TXN-${Math.random().toString(36).substring(2, 10).toUpperCase()}`;
70}
71
72// Truncate text to a specific length with ellipsis
73export function truncateText(text: string, maxLength: number): string {
74 if (text.length <= maxLength) return text;
75 return text.substring(0, maxLength) + "...";
77
78// Validate email format
79export function isValidEmail(email: string): boolean {
80 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
81 return emailRegex.test(email);
83
84// Validate password strength
85export function isStrongPassword(password: string): boolean {
86 // At least 8 characters, with at least one uppercase, one lowercase, and one number
87 const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/;

Appkyqueries.ts14 matches

@OssyNachโ€ขUpdated 3 days ago
4
5// User queries
6export async function getUserByEmail(email: string): Promise<User | null> {
7 const result = await sqlite.execute(
8 `SELECT * FROM ${USERS_TABLE} WHERE email = ?`,
13}
14
15export async function getUserById(id: number): Promise<User | null> {
16 const result = await sqlite.execute(
17 `SELECT * FROM ${USERS_TABLE} WHERE id = ?`,
22}
23
24export async function createUser(user: Omit<User, 'id' | 'created_at'>): Promise<number> {
25 const result = await sqlite.execute(
26 `INSERT INTO ${USERS_TABLE} (email, password_hash, name, preferences)
34
35// Agency queries
36export async function getAllAgencies(): Promise<Agency[]> {
37 const result = await sqlite.execute(`SELECT * FROM ${AGENCIES_TABLE}`);
38 return result.rows as Agency[];
39}
40
41export async function getAgencyById(id: number): Promise<Agency | null> {
42 const result = await sqlite.execute(
43 `SELECT * FROM ${AGENCIES_TABLE} WHERE id = ?`,
49
50// Travel package queries
51export async function getAllPackages(limit = 20, offset = 0): Promise<TravelPackage[]> {
52 const result = await sqlite.execute(
53 `SELECT p.*, a.name as agency_name
62}
63
64export async function getPackageById(id: number): Promise<TravelPackage | null> {
65 const result = await sqlite.execute(
66 `SELECT p.*, a.name as agency_name
74}
75
76export async function searchPackages(params: SearchParams): Promise<TravelPackage[]> {
77 let query = `
78 SELECT p.*, a.name as agency_name
126}
127
128export async function getFeaturedPackages(limit = 6): Promise<TravelPackage[]> {
129 const result = await sqlite.execute(
130 `SELECT p.*, a.name as agency_name
141
142// Booking queries
143export async function createBooking(booking: Omit<Booking, 'id' | 'booking_date'>): Promise<number> {
144 const result = await sqlite.execute(
145 `INSERT INTO ${BOOKINGS_TABLE} (
162}
163
164export async function getBookingById(id: number): Promise<Booking | null> {
165 const result = await sqlite.execute(
166 `SELECT b.*, p.title as package_title, p.destination, p.image_url, p.start_date, p.end_date
174}
175
176export async function getUserBookings(userId: number): Promise<Booking[]> {
177 const result = await sqlite.execute(
178 `SELECT b.*, p.title as package_title, p.destination, p.image_url, p.start_date, p.end_date
187}
188
189export async function updateBookingStatus(id: number, status: string, paymentId?: string): Promise<boolean> {
190 const updateFields = paymentId
191 ? `status = ?, payment_id = ?, payment_status = 'completed'`
207
208// Update available spots when booking is confirmed
209export async function updatePackageAvailability(packageId: number, travelerCount: number): Promise<boolean> {
210 const result = await sqlite.execute(
211 `UPDATE ${PACKAGES_TABLE}

Appkymigrations.ts2 matches

@OssyNachโ€ขUpdated 3 days ago
7export const BOOKINGS_TABLE = "travel_bookings_v1";
8
9export async function runMigrations() {
10 // Users table
11 await sqlite.execute(`
76}
77
78async function insertSampleData() {
79 // Check if we already have sample data
80 const agencyCount = await sqlite.execute(`SELECT COUNT(*) as count FROM ${AGENCIES_TABLE}`);

AppkyREADME.md3 matches

@OssyNachโ€ขUpdated 3 days ago
17โ”‚ โ”œโ”€โ”€ database/
18โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
19โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # DB query functions
20โ”‚ โ”œโ”€โ”€ routes/ # API route handlers
21โ”‚ โ”‚ โ”œโ”€โ”€ agencies.ts # Agency-related endpoints
31โ”‚ โ”‚ โ”œโ”€โ”€ Header.tsx # Navigation header
32โ”‚ โ”‚ โ”œโ”€โ”€ PackageCard.tsx # Travel package display card
33โ”‚ โ”‚ โ”œโ”€โ”€ SearchForm.tsx # Search functionality
34โ”‚ โ”‚ โ””โ”€โ”€ BookingFlow.tsx # Booking and payment process
35โ”‚ โ”œโ”€โ”€ index.html # Main HTML template
37โ””โ”€โ”€ shared/
38 โ”œโ”€โ”€ types.ts # Shared type definitions
39 โ””โ”€โ”€ utils.ts # Shared utility functions
40```
41

LiveStormMCPREADME.md1 match

@supagroovaโ€ขUpdated 3 days ago
21
22- `index.ts`: Main entry point with HTTP trigger
23- `livestormApi.ts`: Functions to fetch and parse the OpenAPI definition
24- `mcp.ts`: MCP server setup and configuration

getFileEmail4 file matches

@shouserโ€ขUpdated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 4 weeks 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.