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=88&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 20320 results for "function"(1937ms)

cerebras_coderindex.html1 match

@w3bโ€ขUpdated 2 days ago
19 <meta property="og:site_name" content="Cerebras Coder">
20 <meta property="og:url" content="https://cerebrascoder.com"/>
21 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second โ€“ powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

cerebras_codergenerate-code.ts2 matches

@w3bโ€ขUpdated 2 days ago
2import STARTER_PROMPTS from "../public/starter-prompts.js";
3
4function extractCodeFromFence(text: string): string {
5 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6 return htmlMatch ? htmlMatch[1].trim() : text;
7}
8
9export async function generateCode(prompt: string, currentCode: string) {
10 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11 if (starterPrompt) {

plantprofilePlantDetail.tsx1 match

@seipatiannah1โ€ขUpdated 2 days ago
21 };
22
23 // Function to print the plant profile
24 const handlePrint = () => {
25 const printContent = document.getElementById('plant-profile-content');

plantprofilequeries.ts5 matches

@seipatiannah1โ€ขUpdated 2 days ago
4
5// Create a new plant profile
6export async function createPlantProfile(plant: Omit<PlantProfile, "id" | "created_at" | "updated_at">): Promise<PlantProfile> {
7 const result = await sqlite.execute(
8 `INSERT INTO ${PLANTS_TABLE} (
26
27// Get all plant profiles
28export async function getAllPlantProfiles(): Promise<PlantProfile[]> {
29 const result = await sqlite.execute(`SELECT * FROM ${PLANTS_TABLE} ORDER BY name ASC`);
30 return result.rows as PlantProfile[];
32
33// Get a plant profile by ID
34export async function getPlantProfileById(id: number): Promise<PlantProfile | null> {
35 const result = await sqlite.execute(
36 `SELECT * FROM ${PLANTS_TABLE} WHERE id = ?`,
46
47// Update a plant profile
48export async function updatePlantProfile(
49 id: number,
50 plant: Partial<Omit<PlantProfile, "id" | "created_at" | "updated_at">>
118
119// Delete a plant profile
120export async function deletePlantProfile(id: number): Promise<boolean> {
121 const result = await sqlite.execute(
122 `DELETE FROM ${PLANTS_TABLE} WHERE id = ?`,

plantprofilemigrations.ts1 match

@seipatiannah1โ€ขUpdated 2 days ago
4export const PLANTS_TABLE = "plant_profiles_v1";
5
6export async function setupDatabase() {
7 // Create the plants table if it doesn't exist
8 await sqlite.execute(`

untitled-4762new-file-9178.tsx1 match

@Damiโ€ขUpdated 2 days ago
1export default async function (e: Email) {
2
3}

FirstProjectqueries.ts4 matches

@MiracleSanctuaryโ€ขUpdated 2 days ago
20
21// Job posting queries
22export async function getAllJobPostings(): Promise<JobPosting[]> {
23 const result = await sqlite.execute(
24 `SELECT * FROM ${JOB_POSTINGS_TABLE} ORDER BY created_at DESC`
27}
28
29export async function createJobPosting(job: JobPosting): Promise<JobPosting> {
30 const timestamp = Date.now();
31 const result = await sqlite.execute(
39
40// Chat message queries
41export async function getChatMessages(limit = 50): Promise<ChatMessage[]> {
42 const result = await sqlite.execute(
43 `SELECT * FROM ${CHAT_MESSAGES_TABLE}
49}
50
51export async function createChatMessage(message: ChatMessage): Promise<ChatMessage> {
52 const timestamp = Date.now();
53 const result = await sqlite.execute(

FirstProjectmigrations.ts1 match

@MiracleSanctuaryโ€ขUpdated 2 days ago
8 * Initialize database tables
9 */
10export async function initializeDatabase() {
11 // Create job postings table
12 await sqlite.execute(`

FirstProjectREADME.md1 match

@MiracleSanctuaryโ€ขUpdated 2 days ago
19โ”‚ โ”œโ”€โ”€ database/
20โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
21โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # DB query functions
22โ”‚ โ”œโ”€โ”€ routes/
23โ”‚ โ”‚ โ”œโ”€โ”€ jobs.ts # Job posting routes

JobPlatformapp.js16 matches

@MiracleSanctuaryโ€ขUpdated 2 days ago
21init();
22
23async function init() {
24 // Set view source link
25 setViewSourceLink();
41}
42
43function setViewSourceLink() {
44 // Get the current URL and convert it to Val Town URL
45 const currentUrl = window.location.href;
49
50// Event Listeners
51function setupEventListeners() {
52 // Job form submission
53 jobForm.addEventListener('submit', async (e) => {
82}
83
84// Job Functions
85async function loadJobs() {
86 try {
87 const response = await fetch('/api/jobs');
111}
112
113async function submitJobPosting() {
114 try {
115 const formData = {
148}
149
150// Chat Functions
151function enableChat() {
152 usernameContainer.innerHTML = `<p class="text-sm text-gray-600">Chatting as: <span class="font-semibold">${escapeHtml(username)}</span> <button id="change-username" class="text-blue-600 text-xs hover:underline">Change</button></p>`;
153
185}
186
187async function loadChatMessages() {
188 try {
189 const response = await fetch('/api/chat');
210}
211
212function renderChatMessages(messages) {
213 chatMessages.innerHTML = messages.map(msg => `
214 <div class="chat-message ${msg.username === username ? 'text-right' : ''}">
225}
226
227function startChatPolling() {
228 // Clear any existing interval
229 if (chatPollingInterval) {
273}
274
275async function sendChatMessage() {
276 const message = chatInput.value.trim();
277 if (!message || !username) return;
306}
307
308// Utility Functions
309function formatDate(timestamp) {
310 if (!timestamp) return 'Unknown';
311
318}
319
320function formatTime(timestamp) {
321 if (!timestamp) return '';
322
328}
329
330function escapeHtml(str) {
331 if (!str) return '';
332 return str

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.