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=936&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 18128 results for "function"(2252ms)

cerebras_coderindex.html1 match

@asifahmedayaan•Updated 2 months 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

@asifahmedayaan•Updated 2 months 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

@asifahmedayaan•Updated 2 months 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

@asifahmedayaan•Updated 2 months 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) {

Chatterymain.tsx3 matches

@srijanb69•Updated 2 months ago
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [messages, setMessages] = useState([]);
7 const [input, setInput] = useState("");
91}
92
93function client() {
94 createRoot(document.getElementById("root")).render(<App />);
95}
96if (typeof document !== "undefined") { client(); }
97
98export default async function server(request: Request): Promise<Response> {
99 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
100 const { OpenAI } = await import("https://esm.town/v/std/openai");

create3DEmojiREADME.md1 match

@you•Updated 2 months ago
8```
9
10call the function after the DOM has loaded
11```JavaScript
12import { create3DEmoji } from 'https://esm.town/v/iamseeley/threedEmoji';

create3DEmojimain.tsx2 matches

@you•Updated 2 months ago
1import * as THREE from 'https://cdn.skypack.dev/three@0.128.0';
2
3export function create3DEmoji(emoji, width, height) {
4 // canvas element
5 const canvas = document.createElement('canvas');
57
58 // animation loop
59 function animate() {
60 requestAnimationFrame(animate);
61

blob_adminmain.tsx8 matches

@peterqliu•Updated 2 months ago
13}
14
15function Tooltip({ children, content }: TooltipProps) {
16 const [isVisible, setIsVisible] = useState(false);
17 const tooltipRef = useRef<HTMLDivElement>(null);
52}
53
54function formatBytes(bytes: number, decimals = 2) {
55 if (bytes === 0) return "0 Bytes";
56 const k = 1024;
61}
62
63function copyToClipboard(text: string) {
64 navigator.clipboard.writeText(text).then(() => {
65 console.log("Text copied to clipboard");
69}
70
71function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72 const [isOpen, setIsOpen] = useState(false);
73 const menuRef = useRef(null);
76
77 useEffect(() => {
78 function handleClickOutside(event) {
79 if (menuRef.current && !menuRef.current.contains(event.target)) {
80 event.stopPropagation();
158}
159
160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161 const [isLoading, setIsLoading] = useState(false);
162 const decodedKey = decodeURIComponent(blob.key);
219}
220
221function App({ initialEmail, initialProfile }) {
222 const encodeKey = (key: string) => encodeURIComponent(key);
223 const decodeKey = (key: string) => decodeURIComponent(key);
645}
646
647function client() {
648 const initialEmail = document.getElementById("root").getAttribute("data-email");
649 const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));

loopyLettersBirdsmain.tsx4 matches

@alexwein•Updated 2 months ago
19const lettersOnly = (str) => str.replace(/[^a-zA-Z]/g, "");
20
21function Modal({ type, onClose, elapsedTime, wordlist }) {
22 if (type === "instructions") {
23 return (
72}
73
74function App() {
75 const [wordlist, setWordlist] = useState([]);
76 const [currentWordIndex, setCurrentWordIndex] = useState(0);
357}
358
359function client() {
360 createRoot(document.getElementById("root")).render(<App />);
361}
365}
366
367export default async function server(request: Request): Promise<Response> {
368 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
369 const url = new URL(request.url);

smartmain.tsx1 match

@epapercms•Updated 2 months ago
20 Smart ePaper Script - PHP ePaper CMS Script Download One of the standout features of this e-paper Script is
21 its area mapping tool, which enhances user interactivity. Both admin and user levels have access to the area
22 mapping functionality, allowing visitors to highlight specific sections of the e-paper. These highlighted
23 areas can be easily shared on social media or downloaded for future reference.
24

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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",