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%22Image%20title%22?q=function&page=101&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 20394 results for "function"(1749ms)

createInteractionForm.tsx1 match

@charmaineโ€ขUpdated 2 days ago
7}
8
9export default function InteractionForm({ onSubmit }: InteractionFormProps) {
10 const [formData, setFormData] = useState<Omit<Interaction, 'contact_id'>>({
11 type: 'call' as InteractionType,

createContactDetail.tsx1 match

@charmaineโ€ขUpdated 2 days ago
11}
12
13export default function ContactDetail({
14 contact,
15 onEdit,

createContactForm.tsx1 match

@charmaineโ€ขUpdated 2 days ago
8}
9
10export default function ContactForm({ contact, onSubmit }: ContactFormProps) {
11 const [formData, setFormData] = useState<Contact>({
12 id: contact?.id,

createContactList.tsx1 match

@charmaineโ€ขUpdated 2 days ago
9}
10
11export default function ContactList({
12 contacts,
13 selectedContactId,

createApp.tsx1 match

@charmaineโ€ขUpdated 2 days ago
6import ContactForm from "./ContactForm.tsx";
7
8export default function App() {
9 const [contacts, setContacts] = useState<Contact[]>([]);
10 const [selectedContact, setSelectedContact] = useState<Contact | null>(null);

createqueries.ts9 matches

@charmaineโ€ขUpdated 2 days ago
4
5// Contact queries
6export async function getAllContacts(): Promise<Contact[]> {
7 const result = await sqlite.execute(`SELECT * FROM ${CONTACTS_TABLE} ORDER BY name ASC`);
8 return result.rows as Contact[];
9}
10
11export async function getContactById(id: number): Promise<Contact | null> {
12 const result = await sqlite.execute(
13 `SELECT * FROM ${CONTACTS_TABLE} WHERE id = ?`,
17}
18
19export async function createContact(contact: Contact): Promise<number> {
20 const { name, email, phone, company, notes } = contact;
21 const result = await sqlite.execute(
27}
28
29export async function updateContact(id: number, contact: Contact): Promise<boolean> {
30 const { name, email, phone, company, notes } = contact;
31 const result = await sqlite.execute(
38}
39
40export async function deleteContact(id: number): Promise<boolean> {
41 const result = await sqlite.execute(
42 `DELETE FROM ${CONTACTS_TABLE} WHERE id = ?`,
46}
47
48export async function searchContacts(query: string): Promise<Contact[]> {
49 const searchTerm = `%${query}%`;
50 const result = await sqlite.execute(
58
59// Interaction queries
60export async function getInteractionsByContactId(contactId: number): Promise<Interaction[]> {
61 const result = await sqlite.execute(
62 `SELECT * FROM ${INTERACTIONS_TABLE}
68}
69
70export async function createInteraction(interaction: Interaction): Promise<number> {
71 const { contact_id, type, notes, date } = interaction;
72 const result = await sqlite.execute(
78}
79
80export async function deleteInteraction(id: number): Promise<boolean> {
81 const result = await sqlite.execute(
82 `DELETE FROM ${INTERACTIONS_TABLE} WHERE id = ?`,

createmigrations.ts1 match

@charmaineโ€ขUpdated 2 days ago
5export const INTERACTIONS_TABLE = 'personal_crm_interactions';
6
7export async function runMigrations() {
8 // Create contacts table
9 await sqlite.execute(`

createREADME.md1 match

@charmaineโ€ขUpdated 2 days ago
16โ”‚ โ”œโ”€โ”€ database/
17โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
18โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # DB query functions
19โ”‚ โ”œโ”€โ”€ routes/ # Route modules
20โ”‚ โ”‚ โ””โ”€โ”€ api.ts # API endpoints

PRChecker2index.tsx2 matches

@tagawaโ€ขUpdated 2 days ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export default function GitHubPRAnalyzer() {
5 const [prUrl, setPrUrl] = useState("");
6 const [analysis, setAnalysis] = useState<any>(null);
7 const [loading, setLoading] = useState(false);
8
9 async function analyzeGitHubPR() {
10 setLoading(true);
11 try {

untitled-2444processor.ts10 matches

@allโ€ขUpdated 2 days ago
19 * Process large text by splitting into chunks and sending to OpenAI
20 */
21export async function processLargeText(
22 text: string,
23 instructions: string,
102 * Create a prompt based on script type
103 */
104function createPromptForScriptType(
105 chunk: string,
106 instructions: string,
204 * Enhance instructions based on script type
205 */
206function enhanceInstructions(instructions: string, scriptType: string): string {
207 // If instructions already seem comprehensive, return as is
208 if (instructions.length > 100) {
235 * Generate a unique session ID
236 */
237function generateSessionId(): string {
238 return `script_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
239}
242 * Save processing session data
243 */
244async function saveProcessingSession(sessionId: string, data: any): Promise<void> {
245 await blob.setJSON(`sessions/${sessionId}`, data);
246}
249 * Update processing progress
250 */
251async function updateProcessingProgress(sessionId: string, currentChunk: number, totalChunks: number): Promise<void> {
252 const session = await blob.getJSON(`sessions/${sessionId}`);
253 if (session) {
265 * Save processing result
266 */
267async function saveProcessingResult(sessionId: string, result: string): Promise<void> {
268 const session = await blob.getJSON(`sessions/${sessionId}`);
269 if (session) {
289 * Process a single chunk with OpenAI
290 */
291async function processChunkWithOpenAI(
292 chunk: string,
293 instructions: string,
338 * Combine processed chunks into a single text with improved handling
339 */
340function combineProcessedChunks(chunks: string[]): string {
341 if (chunks.length === 1) {
342 return chunks[0];
367 * Find the optimal overlap size between two text chunks
368 */
369function findOptimalOverlapSize(end: string, start: string): number {
370 // Look for the largest common substring at the end of the first chunk
371 // and the beginning of the second chunk

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
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.