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/$%7Bsuccess?q=function&page=62&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 19769 results for "function"(1464ms)

town-hallErrorMessage.tsx1 match

@stevekrouse•Updated 2 days ago
7}
8
9export function ErrorMessage({ message, onDismiss }: ErrorMessageProps) {
10 return (
11 <div

cerebras_codermain.tsx11 matches

@poarox•Updated 2 days ago
24);
25
26function Hero({
27 prompt,
28 setPrompt,
45
46 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47 Turn your ideas into fully functional apps in{" "}
48 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49 less than a second
116}
117
118function App() {
119 const previewRef = React.useRef<HTMLDivElement>(null);
120 const [prompt, setPrompt] = useState("");
170 });
171
172 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173 setLoading(true);
174 setTimeout(() => handleSubmit(promptItem.prompt), 0);
175 }
176
177 async function handleSubmit(e: React.FormEvent | string) {
178 if (typeof e !== "string") {
179 e.preventDefault();
226 }
227
228 function handleVersionChange(direction: "back" | "forward") {
229 const { currentVersionIndex, versions } = versionHistory;
230 if (direction === "back" && currentVersionIndex > 0) {
921);
922
923function client() {
924 const path = window.location.pathname;
925 const root = createRoot(document.getElementById("root")!);
957}
958
959function extractCodeFromFence(text: string): string {
960 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
961 return htmlMatch ? htmlMatch[1].trim() : text;
962}
963
964async function generateCode(prompt: string, currentCode: string) {
965 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
966 if (starterPrompt) {
1007}
1008
1009export default async function cerebras_coder(req: Request): Promise<Response> {
1010 // Dynamic import for SQLite to avoid client-side import
1011 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1110 <meta property="og:site_name" content="Cerebras Coder">
1111 <meta property="og:url" content="https://cerebrascoder.com"/>
1112 <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."">
1113 <meta property="og:type" content="website">
1114 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

ValTown-Package-Trackerindex.html8 matches

@jhiller•Updated 2 days ago
139
140 // Initialize the application
141 async function init() {
142 await loadDevices();
143 await loadLocations();
149
150 // Load devices for the selector
151 async function loadDevices() {
152 try {
153 const response = await fetch('/api/devices');
172
173 // Load location data
174 async function loadLocations() {
175 try {
176 const deviceId = deviceSelector.value;
200
201 // Clear map markers and polyline
202 function clearMap() {
203 markers.forEach(marker => map.removeLayer(marker));
204 markers = [];
211
212 // Add locations to the map
213 function addLocationsToMap(locations) {
214 if (!locations.length) {
215 locationHistory.innerHTML = '<p class="text-gray-500 italic">No location data available</p>';
283
284 // Show location details in the info panel
285 function showLocationDetails(location) {
286 // Parse the gateways JSON string if needed
287 let gateways = [];
364
365 // Update the location history panel
366 function updateLocationHistory() {
367 if (!locations.length) {
368 locationHistory.innerHTML = '<p class="text-gray-500 italic">No location history available</p>';
421
422 // Highlight the selected history item
423 function highlightHistoryItem(id) {
424 document.querySelectorAll('.location-item').forEach(item => {
425 if (parseInt(item.dataset.id) === id) {

ValTown-Package-Trackerindex.ts1 match

@jhiller•Updated 2 days ago
15};
16
17function isInNorthAmerica(lat: number, lng: number): boolean {
18 return (
19 lat >= NA_BOUNDS.latMin &&

ipv4-counterdatabase.ts4 matches

@maxm•Updated 2 days ago
16 * Initialize the database with our table
17 */
18export async function initDatabase() {
19 await sqlite.execute(`
20 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
33 * If not, create a new record
34 */
35export async function recordVisit(ip: string): Promise<void> {
36 const now = new Date().toISOString();
37 await sqlite.execute(
48 * Get all visit records
49 */
50export async function getAllVisits(): Promise<VisitRecord[]> {
51 const result = await sqlite.execute(
52 `SELECT * FROM ${TABLE_NAME} ORDER BY visits DESC`,
59 * Get total visit count across all IPs
60 */
61export async function getTotalVisits(): Promise<number> {
62 const result = await sqlite.execute(
63 `SELECT SUM(visits) as total FROM ${TABLE_NAME}`,

subdomainsreels.tsx1 match

@rayyan•Updated 2 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

subdomainslnk.tsx1 match

@rayyan•Updated 2 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

subdomainslink.tsx1 match

@rayyan•Updated 2 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

subdomainsurl.tsx1 match

@rayyan•Updated 2 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

subdomainsroute.tsx1 match

@rayyan•Updated 2 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

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.