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=892&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 18323 results for "function"(1013ms)

cerebras_coderindex.html1 match

@speedaddโ€ขUpdated 1 month 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_coderindex2 matches

@speedaddโ€ขUpdated 1 month ago
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
20await createTables();
21
22export default async function cerebras_coder(req: Request): Promise<Response> {
23 if (req.method === "POST") {
24 let { prompt, currentCode, versionHistory, projectId } = await req.json();

cerebras_coderindex7 matches

@speedaddโ€ขUpdated 1 month 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_codergenerate-code2 matches

@speedaddโ€ขUpdated 1 month 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) {

inquisitiveTealMuskoxmain.tsx5 matches

@mirzaโ€ขUpdated 1 month ago
8 "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";
9
10function RobotIcon({ isDarkMode }) {
11 return (
12 <svg
23}
24
25function App() {
26 const [messages, setMessages] = useState([]);
27 const [inputValue, setInputValue] = useState("");
78 }, [messages]);
79
80 // Function to check if the question is about creation or development
81 const isCreationQuestion = (text) => {
82 const creationKeywords = [
257}
258
259function client() {
260 createRoot(document.getElementById("root")).render(<App />);
261}
262if (typeof document !== "undefined") { client(); }
263
264export default async function server(request: Request): Promise<Response> {
265 return new Response(
266 `

example_toolmain.tsx2 matches

@ajaxโ€ขUpdated 1 month ago
2import { generateText } from "npm:ai";
3
4export default async function(req: Request): Promise<Response> {
5 if (req.method !== "POST") {
6 return Response.json({ message: "This function only accepts POST requests." }, { status: 400 });
7 }
8 try {

angerTranslatorAppmain.tsx3 matches

@mirzaโ€ขUpdated 1 month ago
46};
47
48function App() {
49 const mountRef = useRef(null);
50 const [message, setMessage] = useState('');
365}
366
367function client() {
368 const container = document.getElementById('root');
369 const root = ReactDOM.createRoot(container);
375}
376
377export default async function server(request: Request): Promise<Response> {
378 return new Response(`
379 <!DOCTYPE html>

debatebasemain.tsx6 matches

@apiโ€ขUpdated 1 month ago
29
30// Enhanced logging utility
31function log(level: "INFO" | "WARN" | "ERROR", message: string, context?: any) {
32 const timestamp = new Date().toISOString();
33 const logEntry = {
85const AGENT_AVATARS = ["๐Ÿง ", "๐Ÿ‘จโ€โš–๏ธ", "๐Ÿ‘ฉโ€๐Ÿ”ฌ", "๐Ÿ‘จโ€๐Ÿ’ผ", "๐Ÿ‘ฉโ€๐ŸŽ“", "๐Ÿง™โ€โ™‚๏ธ", "๐Ÿ‘ฉโ€๐ŸŒพ", "๐Ÿ‘จโ€๐Ÿš€"];
86
87function App() {
88 // States for the simulation
89 const [agents, setAgents] = useState<Agent[]>([]);
198 };
199
200 // Moderator function to manage speaking turns
201 const moderator = {
202 // Process speaking queue and determine next speaker
764}
765
766function client() {
767 createRoot(document.getElementById("root")).render(<App />);
768}
769if (typeof document !== "undefined") { client(); }
770
771export default async function server(request: Request): Promise<Response> {
772 const { OpenAI } = await import("https://esm.town/v/std/openai");
773 const openai = new OpenAI();
774
775 // Enhanced server-side logging
776 function serverLog(level: "INFO" | "WARN" | "ERROR", message: string, context?: any) {
777 const timestamp = new Date().toISOString();
778 const logEntry = {

guestbookAddMessagemain.tsx1 match

@maemoonโ€ขUpdated 1 month ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

getGuestbookMessagesmain.tsx1 match

@maemoonโ€ขUpdated 1 month ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4export default async function(req: Request): Promise<Response> {
5 const TABLE_NAME = "guestbook";
6

getFileEmail4 file matches

@shouserโ€ขUpdated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 2 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.