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/?q=function&page=547&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 20176 results for "function"(2326ms)

cerebras_codermain.tsx1 match

@Trey39โ€ขUpdated 4 weeks ago
6await createTables();
7
8export default async function cerebras_coder(req: Request): Promise<Response> {
9 if (req.method === "POST") {
10 let { prompt, currentCode, versionHistory, projectId } = await req.json();

cerebras_coderindex.ts7 matches

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

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

@Trey39โ€ขUpdated 4 weeks 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) {

getdependenciesmain.tsx2 matches

@jdkdevโ€ขUpdated 4 weeks ago
1async function getLibrariesIoDependents(packageName: string) {
2 // Retrieve API key from environment variable
3 const apiKey = Deno.env.get("LIBRARY_IO");
38}
39
40export default async function server(request: Request): Promise<Response> {
41 try {
42 // Fetch dependents for react package

stevensDemoSETUP.md1 match

@yumyabโ€ขUpdated 4 weeks ago
22To use all features, you'll need to set these environment variables:
23
24#### For LLM functionality:
25- `ANTHROPIC_API_KEY` - For AI responses and daily briefings
26

stevensDemocronDailyBrief.ts1 match

@yumyabโ€ขUpdated 4 weeks ago
2import { sendDailyBriefing } from "./sendDailyBrief.ts";
3
4export async function cronDailyBrief() {
5 try {
6 console.log("Sending scheduled daily briefing...");

hello-worldindex.http.tsx1 match

@wolfโ€ขUpdated 4 weeks ago
1export default async function(req: Request): Promise<Response> {
2 const test = await Deno.readTextFile("deno.json");
3 return new Response("Hello world! -Wolf" + test);

promptEvolvermain.tsx12 matches

@toowiredโ€ขUpdated 4 weeks ago
15const APP_VERSION = "7.2.1-pipeline-integrated"; // Updated version identifier
16
17// โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” AI Prompt Engineering Functions (Verbatim from Pipeline Description) โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” //
18
19// Prompt for Stage 2: Core Intent Identification
20function createIntentExtractionPrompt(text: string): string {
21 return `Analyze the following text and provide ONLY a concise summary (1-2 sentences) capturing the core message, key claims, and overall purpose. Text: "${text}"`;
22}
23
24// Prompt for Stages 3-6: Main Improvement (incorporates core intent)
25function createMainImprovementPrompt(originalText: string, coreIntentSummary: string): string {
26 return `
27 You are an expert editor assisting a user with ADHD, 2e, Aphantasia, and Anauralia.
34 1. **Structure:** Reorganize for logical flow. Group related ideas. Add minimal transitions ONLY where needed to bridge gaps. Evaluate tangents against the core intent; prune non-essential ones.
35 2. **Clarity/Conciseness:** Simplify complex sentences ONLY if nuance isn't lost (verify against core intent). Remove redundancy ONLY if it adds no value. Resolve ambiguities.
36 3. **Sensory Language:** Replace visual/auditory descriptions/metaphors with functional, logical, or factual equivalents.
37 4. **Grammar/Spelling:** Correct all standard English errors.
38
49
50// โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” React App Component (Integrating Pipeline Logic Display) โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” //
51function App() {
52 // State variables from original PRESERVED, plus new progress state
53 const [inputText, setInputText] = useState("");
138 // --- End Speech Recognition ---
139
140 // Manual Improvement Function - UPDATED for Pipeline & Progress Indicator
141 const handleManualImprove = useCallback(async () => {
142 const currentInput = inputText.trim();
213 }, [inputText]); // Dependencies for useCallback
214
215 // Render functions (kept from original)
216 const renderTextStats = () => { // Will likely not render as backend doesn't send stats
217 if (!textStats || Object.keys(textStats).length === 0) return null;
434
435// --- Client-side Bootstrapping (Kept from original) ---
436function client() {
437 const rootElement = document.getElementById("root");
438 if (rootElement) { createRoot(rootElement).render(<App />); }
441if (typeof document !== "undefined") { client(); }
442
443// --- Helper Function for Server (Pipeline Logic) ---
444async function runImprovementPipeline(
445 originalText: string,
446 openai: OpenAI,
485}
486
487// --- Val.town Server Function (Updated POST Handler) ---
488export default async function server(req: Request): Promise<Response> {
489 const url = new URL(req.url);
490 const apiKey = Deno.env.get("OPENAI_API_KEY");

reflectivePinkBeavermain.tsx3 matches

@MDX82340โ€ขUpdated 4 weeks ago
9}
10
11function App() {
12 const profileName = "Your Name";
13 const profileBio = "Brief description about yourself";
81}
82
83function client() {
84 createRoot(document.getElementById("root")).render(<App />);
85}
86if (typeof document !== "undefined") { client(); }
87
88export default async function server(request: Request): Promise<Response> {
89 return new Response(
90 `

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.