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=890&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 18322 results for "function"(1870ms)

cerebras_coder

cerebras_coderindex2 matches

@Proking2005•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_coder

cerebras_coderindex7 matches

@Proking2005•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")!);

feedbinUnreadsmain.tsx2 matches

@kamalnrf•Updated 1 month ago
5const BASE_URL = "https://api.feedbin.com/v2/";
6
7export async function getFeedbinUnreadEntries() {
8 const authString = Buffer.from(AUTH_STRING).toString("base64");
9
72}
73
74export default async function(req: Request): Promise<Response> {
75 try {
76 const result = await getFeedbinUnreadEntries();

adaptableLimePelicanmain.tsx6 matches

@ritam_09•Updated 1 month ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function Logo() {
6 return (
7 <svg width="50" height="50" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
17}
18
19function Footer() {
20 return (
21 <footer className="app-footer">
32}
33
34function WelcomePage({ onStart }) {
35 return (
36 <div className="welcome-container">
47}
48
49function App() {
50 const [messages, setMessages] = useState([
51 {
184}
185
186function client() {
187 createRoot(document.getElementById("root")).render(<App />);
188}
189if (typeof document !== "undefined") { client(); }
190
191export default async function server(request: Request): Promise<Response> {
192 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
193 const { OpenAI } = await import("https://esm.town/v/std/openai");

statusstatus3 matches

@cameron•Updated 1 month ago
9const thisURL = parseProject(import.meta.url).links.self.project;
10
11function StatusRow({ rows }) {
12 return (
13 <div className="w-full flex flex-col space-y-2">
31}
32
33function StatusSection({ url, rows }) {
34 const sectionRows = rows.filter(row => row[0] === url);
35 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
47}
48
49export default async function(req: Request): Promise<Response> {
50 const { rows } = await sqlite.execute(
51 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

statussparklineSVG1 match

@cameron•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;

statusnotify1 match

@cameron•Updated 1 month ago
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}

statusmonitor1 match

@cameron•Updated 1 month ago
7);
8
9export async function uptimeCheck(url: string, attempt = 1) {
10 let reason: string = "";
11 let status: number | null = null;

chatGPTClonemain.tsx5 matches

@Ritam•Updated 1 month ago
4import Tesseract from 'https://esm.sh/tesseract.js';
5
6function WelcomePage({ onStart }) {
7 return (
8 <div className="welcome-container">
32}
33
34function ReportAnalysisPage({ onBack, onAnalyzeComplete }) {
35 const [step, setStep] = useState('upload');
36 const [uploadedImage, setUploadedImage] = useState(null);
190}
191
192function App() {
193 const [view, setView] = useState('welcome');
194 const [messages, setMessages] = useState([
333}
334
335function client() {
336 createRoot(document.getElementById("root")).render(<App />);
337}
338if (typeof document !== "undefined") { client(); }
339
340export default async function server(request: Request): Promise<Response> {
341 if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
342 const { OpenAI } = await import("https://esm.town/v/std/openai");
hello_color

hello_colormain.tsx2 matches

@jxnblk•Updated 1 month ago
74 padding: 32,
75 transitionProperty: 'color, background-color',
76 transitionTimingFunction: 'ease-out',
77 transitionDuration: '1s, .5s',
78 cursor: 'pointer',
101 backgroundColor: color,
102 transitionProperty: 'color, background-color',
103 transitionTimingFunction: 'ease-out',
104 transitionDuration: '1s, .5s'
105 }

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.