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=74&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 20183 results for "function"(1141ms)

cerebras_coderindex.ts7 matches

@w3bโ€ขUpdated 1 day ago
23);
24
25function Hero({
26 prompt,
27 setPrompt,
44
45 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
46 Turn your ideas into fully functional apps in{" "}
47 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
48 less than a second
115}
116
117function App() {
118 const previewRef = React.useRef<HTMLDivElement>(null);
119 const [prompt, setPrompt] = useState("");
169 });
170
171 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
172 setLoading(true);
173 setTimeout(() => handleSubmit(promptItem.prompt), 0);
174 }
175
176 async function handleSubmit(e: React.FormEvent | string) {
177 if (typeof e !== "string") {
178 e.preventDefault();
225 }
226
227 function handleVersionChange(direction: "back" | "forward") {
228 const { currentVersionIndex, versions } = versionHistory;
229 if (direction === "back" && currentVersionIndex > 0) {
973);
974
975function client() {
976 const path = window.location.pathname;
977 const root = createRoot(document.getElementById("root")!);

cerebras_coderindex.html1 match

@w3bโ€ขUpdated 1 day 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 1 day 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 1 day 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 1 day 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 1 day 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 1 day ago
1export default async function (e: Email) {
2
3}

FirstProjectqueries.ts4 matches

@MiracleSanctuaryโ€ขUpdated 1 day 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 1 day ago
8 * Initialize database tables
9 */
10export async function initializeDatabase() {
11 // Create job postings table
12 await sqlite.execute(`

FirstProjectREADME.md1 match

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

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.