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/image-url.jpg%20%22Optional%20title%22?q=function&page=81&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 20374 results for "function"(1269ms)

HTOCutils.ts3 matches

@homestocompare•Updated 2 days ago
1// Format price as currency
2export function formatPrice(price: number): string {
3 return new Intl.NumberFormat('en-US', {
4 style: 'currency',
9
10// Format number with commas
11export function formatNumber(num: number): string {
12 return new Intl.NumberFormat('en-US').format(num);
13}
14
15// Format bathrooms (handle .5 for half baths)
16export function formatBathrooms(bathrooms: number): string {
17 return bathrooms % 1 === 0 ? bathrooms.toString() : bathrooms.toFixed(1);
18}

Jop-Apputils.ts5 matches

@Nixee•Updated 2 days ago
21}
22
23// Utility functions that work in both browser and Deno
24export function formatDate(dateString: string): string {
25 if (!dateString) return '';
26 const date = new Date(dateString);
32}
33
34export function formatTime(dateString: string): string {
35 if (!dateString) return '';
36 const date = new Date(dateString);
42
43// Validation utilities
44export function validateEmail(email: string): boolean {
45 const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
46 return re.test(email);
47}
48
49export function validateJobPosting(job: Partial<JobPosting>): { valid: boolean; error?: string } {
50 if (!job.title || job.title.trim() === '') {
51 return { valid: false, error: 'Job title is required' };

Jop-Appindex.js2 matches

@Nixee•Updated 2 days ago
1function app() {
2 return {
3 // State
218 },
219
220 // Utility functions
221 formatDate(dateString) {
222 if (!dateString) return '';

HTOCREADME.md3 matches

@homestocompare•Updated 2 days ago
1# Database Layer
2
3This directory contains the database schema and query functions for the House Hunter application.
4
5## Files
6
7- `migrations.ts` - Contains the database schema definitions and initial data seeding
8- `queries.ts` - Contains functions for querying the database
9
10## Schema
31## Usage
32
33The database is automatically initialized when the application starts. The `runMigrations` function creates the necessary tables and seeds initial data if needed.

HTOCqueries.ts4 matches

@homestocompare•Updated 2 days ago
32
33// Get all properties with optional filtering
34export async function getProperties(filters: PropertyFilters = {}): Promise<Property[]> {
35 let query = `SELECT * FROM ${PROPERTIES_TABLE} WHERE 1=1`;
36 const params: any[] = [];
85
86// Get a single property by ID
87export async function getPropertyById(id: number): Promise<Property | null> {
88 const result = await sqlite.execute(
89 `SELECT * FROM ${PROPERTIES_TABLE} WHERE id = ?`,
99
100// Get cities for dropdown
101export async function getCities(): Promise<string[]> {
102 const result = await sqlite.execute(
103 `SELECT DISTINCT city FROM ${PROPERTIES_TABLE} ORDER BY city ASC`
108
109// Get states for dropdown
110export async function getStates(): Promise<string[]> {
111 const result = await sqlite.execute(
112 `SELECT DISTINCT state FROM ${PROPERTIES_TABLE} ORDER BY state ASC`

HTOCmigrations.ts2 matches

@homestocompare•Updated 2 days ago
5
6// Create tables if they don't exist
7export async function runMigrations() {
8 // Properties table
9 await sqlite.execute(`
37
38// Seed some initial property data
39async function seedInitialData() {
40 const properties = [
41 {

Jop-Appqueries.ts7 matches

@Nixee•Updated 2 days ago
23
24// Job Queries
25export async function getAllJobs(): Promise<JobPosting[]> {
26 const result = await sqlite.execute(
27 `SELECT * FROM ${JOBS_TABLE} ORDER BY created_at DESC`
30}
31
32export async function getJobById(id: number): Promise<JobPosting | null> {
33 const result = await sqlite.execute(
34 `SELECT * FROM ${JOBS_TABLE} WHERE id = ?`,
38}
39
40export async function createJob(job: JobPosting): Promise<number> {
41 const now = new Date().toISOString();
42 const result = await sqlite.execute(
58}
59
60export async function updateJob(id: number, job: Partial<JobPosting>): Promise<boolean> {
61 const now = new Date().toISOString();
62 const currentJob = await getJobById(id);
89}
90
91export async function deleteJob(id: number): Promise<boolean> {
92 await sqlite.execute(`DELETE FROM ${JOBS_TABLE} WHERE id = ?`, [id]);
93 return true;
95
96// Chat Queries
97export async function getChatMessages(limit = 50): Promise<ChatMessage[]> {
98 const result = await sqlite.execute(
99 `SELECT * FROM ${CHAT_MESSAGES_TABLE} ORDER BY created_at DESC LIMIT ?`,
103}
104
105export async function addChatMessage(message: ChatMessage): Promise<number> {
106 const now = new Date().toISOString();
107 const result = await sqlite.execute(

Jop-Appmigrations.ts1 match

@Nixee•Updated 2 days ago
5const CHAT_MESSAGES_TABLE = "chat_messages_v1";
6
7export async function setupDatabase() {
8 // Create jobs table
9 await sqlite.execute(`

yc_finder_quangmain.tsx5 matches

@quang•Updated 2 days ago
23`;
24
25function Hero() {
26 return (
27 <div className="hero">
32}
33
34function HowItWorks() {
35 return (
36 <div className="how-it-works">
53}
54
55function App() {
56 const [ycCompanies, setYcCompanies] = useState<YCCompany[]>([]);
57 const [mergedData, setMergedData] = useState<any[]>([]);
217}
218
219function client() {
220 createRoot(document.getElementById("root")!).render(<App />);
221}
225}
226
227export default async function server(request: Request): Promise<Response> {
228 const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229 const url = new URL(request.url);

yc_findermain.tsx5 matches

@quang•Updated 2 days ago
23`;
24
25function Hero() {
26 return (
27 <div className="hero">
32}
33
34function HowItWorks() {
35 return (
36 <div className="how-it-works">
53}
54
55function App() {
56 const [ycCompanies, setYcCompanies] = useState<YCCompany[]>([]);
57 const [mergedData, setMergedData] = useState<any[]>([]);
217}
218
219function client() {
220 createRoot(document.getElementById("root")!).render(<App />);
221}
225}
226
227export default async function server(request: Request): Promise<Response> {
228 const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229 const url = new URL(request.url);

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",