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=1379&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 18948 results for "function"(2714ms)

sqliteExplorerAppREADME.md1 match

@lecoto•Updated 5 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

blob_adminmain.tsx1 match

@lecoto•Updated 5 months ago
18const PASSWORD_KEY = `${"blob_admin"}_admin_password`;
19
20async function getOrSetPassword() {
21 try {
22 const storedPassword = await blob.get(PASSWORD_KEY);

tidyRedWhalemain.tsx3 matches

@websrai•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function AssistantChat() {
6 const [messages, setMessages] = useState<{role: string, content: string}[]>([
7 { role: 'system', content: 'You are a helpful AI assistant named ValAI, capable of understanding and assisting with various tasks.' }
77}
78
79function client() {
80 createRoot(document.getElementById("root")).render(<AssistantChat />);
81}
82if (typeof document !== "undefined") { client(); }
83
84export default async function server(request: Request): Promise<Response> {
85 if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
86 const { OpenAI } = await import("https://esm.town/v/std/openai");

ImageSummaryEmailmain.tsx3 matches

@jackd•Updated 5 months ago
2import { email } from "https://esm.town/v/std/email";
3
4export default async function(e: Email) {
5 console.log("Email received!", e.from, e.subject);
6
32}
33
34function formatEmailContent(observations: string[]): string {
35 const listItems = observations
36 .map(obs => `<li style="margin-bottom: 8px;">${obs}</li>`)
46}
47
48async function sendReply(to: string, subject: string, body: string) {
49 await email({
50 subject,

generateImageSummarymain.tsx1 match

@jackd•Updated 5 months ago
2import { fileToDataURL } from "https://esm.town/v/stevekrouse/fileToDataURL";
3
4export async function generateImageSummary(image: File): Promise<string[]> {
5 const openai = new OpenAI();
6 const dataURL = await fileToDataURL(image);

modernSalesCRMmain.tsx15 matches

@shrirudragoud•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function Button({ children, onClick, className = '' }) {
6 return (
7 <button
14}
15
16function Input({ placeholder, value, onChange, type = 'text', className = '' }) {
17 return (
18 <input
26}
27
28function Card({ children, className = '' }) {
29 return (
30 <div className={`bg-white shadow-md rounded-lg p-6 ${className}`}>
34}
35
36function CardHeader({ children }) {
37 return <div className="border-b pb-3 mb-4">{children}</div>;
38}
39
40function CardTitle({ children }) {
41 return <h2 className="text-xl font-semibold">{children}</h2>;
42}
43
44function CardContent({ children }) {
45 return <div>{children}</div>;
46}
47
48function Table({ children }) {
49 return <table className="w-full border-collapse">{children}</table>;
50}
51
52function TableHeader({ children }) {
53 return <thead className="bg-gray-100">{children}</thead>;
54}
55
56function TableBody({ children }) {
57 return <tbody>{children}</tbody>;
58}
59
60function TableRow({ children, className = '' }) {
61 return <tr className={`border-b ${className}`}>{children}</tr>;
62}
63
64function TableHead({ children }) {
65 return <th className="px-4 py-2 text-left font-semibold">{children}</th>;
66}
67
68function TableCell({ children }) {
69 return <td className="px-4 py-2">{children}</td>;
70}
71
72function App() {
73 const [leads, setLeads] = useState([]);
74 const [newLead, setNewLead] = useState({ name: '', email: '', phone: '', status: 'New' });
199}
200
201function client() {
202 createRoot(document.getElementById("root")).render(<App />);
203}
204if (typeof document !== "undefined") { client(); }
205
206export default async function server(request: Request): Promise<Response> {
207 try {
208 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

solarsystemmain.tsx3 matches

@tk120404•Updated 5 months ago
5import { OrbitControls } from "https://esm.sh/three/examples/jsm/controls/OrbitControls";
6
7function App() {
8 const mountRef = useRef(null);
9
264}
265
266function client() {
267 createRoot(document.getElementById("root")).render(<App />);
268}
270if (typeof document !== "undefined") { client(); }
271
272export default async function server(request: Request): Promise<Response> {
273 return new Response(`
274 <html>

cerebras_codermain.tsx5 matches

@zananowshad•Updated 5 months ago
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
7
8function App() {
9 const [prompt, setPrompt] = useState("hello llamapalooza");
10 const [code, setCode] = useState("");
18 >(null);
19
20 async function handleSubmit(e: React.FormEvent) {
21 e.preventDefault();
22 setLoading(true);
97}
98
99function client() {
100 createRoot(document.getElementById("root")!).render(<App />);
101}
105}
106
107function extractCodeFromFence(text: string): string {
108 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
109 return htmlMatch ? htmlMatch[1].trim() : text;
110}
111
112export default async function server(req: Request): Promise<Response> {
113 if (req.method === "POST") {
114 const client = new Cerebras();

loginredux_loginmain.tsx1 match

@mittzy•Updated 5 months ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4export default async function(req: Request): Promise<Response> {
5 const body = await req.json();
6 let { username, password } = body;

ampleIndigoJunglefowlmain.tsx8 matches

@faseeu•Updated 5 months ago
4import anime from "https://esm.sh/animejs@3.2.1";
5
6function App() {
7 return (
8 <div className="app">
16}
17
18function BackgroundAnimation() {
19 const svgRef = useRef(null);
20
48}
49
50function Header() {
51 const headerRef = useRef(null);
52
76}
77
78function Hero() {
79 const heroRef = useRef(null);
80 const [text, setText] = useState("Discover the Future of Search");
130}
131
132function Features() {
133 const featuresRef = useRef(null);
134 const [activeFeature, setActiveFeature] = useState(null);
176}
177
178function Footer() {
179 return (
180 <footer className="glassmorphism">
185}
186
187function client() {
188 createRoot(document.getElementById("root")).render(<App />);
189}
193}
194
195export default async function server(request: Request): Promise<Response> {
196 return new Response(`
197 <!DOCTYPE html>

getFileEmail4 file matches

@shouser•Updated 2 weeks 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.