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=30&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 30734 results for "function"(1866ms)

Plantfo

Plantfoindex.ts4 matches

@Llad•Updated 1 day ago
30
31// Generate a simple session token
32function generateSessionToken(): string {
33 return crypto.randomUUID();
34}
35
36// Authentication middleware
37async function requireAuth(c: any, next: any) {
38 const sessionToken = getCookie(c, "admin_session");
39
46
47// Check if user is authenticated (for API endpoints)
48function isAuthenticated(c: any): boolean {
49 const sessionToken = getCookie(c, "admin_session");
50 console.log(`Session token: ${sessionToken}`);
278 console.log("Testing database connection...");
279
280 // Test basic SQLite functionality
281 const testResult = await sqlite.execute("SELECT 1 as test");
282 console.log("Basic SQLite test result:", testResult);

reactHonoStarterApp.tsx1 match

@Hi123•Updated 1 day ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (
Plantfo

PlantfoREADME.md4 matches

@Llad•Updated 1 day ago
9├── backend/
10│ └── database/
11│ └── cache.ts # Database cache functions
12├── test.html # Plant API testing interface
13├── admin.html # Cache admin interface
31- **Interactive plant lookup**: Enter plant names and see real-time API responses
32- **API documentation**: Built-in instructions showing all available endpoints and usage examples
33- **Request URL display**: Shows the exact URL used for each request with copy-to-clipboard functionality
34- **Response formatting**: Pretty-printed JSON responses with syntax highlighting
35- **Error handling**: Clear display of API errors and network issues
46- Plant names, IDs, and creation timestamps
47- Cache management controls (refresh, clear cache)
48- Logout functionality
49
50### GET /login
275- Intelligent plant name normalization for cache consistency
276- Cache management endpoints for monitoring and administration
277- Protected admin interface with login/logout functionality
Plantfo

Plantfotest.html2 matches

@Llad•Updated 1 day ago
128
129 <script>
130 async function testPlant() {
131 const plantName = document.getElementById('plantInput').value.trim();
132 const responseContent = document.getElementById('responseContent');
177
178 // Copy URL to clipboard
179 function copyUrl() {
180 const urlText = document.getElementById('urlDisplay').textContent;
181 navigator.clipboard.writeText(urlText).then(() => {
Plantfo

Plantfoadmin.html2 matches

@Llad•Updated 1 day ago
34
35 <script>
36 async function loadData() {
37 try {
38 const response = await fetch('/admin/cache/full');
66 }
67
68 async function clearCache() {
69 if (!confirm('Are you sure you want to clear all cached data? This action cannot be undone.')) {
70 return;

fashionWardrobefashionWardrobe.tsx3 matches

@kaltesommer•Updated 1 day ago
15 * @returns {Promise<any>} Das gespeicherte Kleidungsstück-Objekt.
16 */
17export async function addWardrobeItem(imageUrl: string, description: string) {
18 if (!imageUrl || !description || description.trim() === "") {
19 throw new Error("imageUrl und description sind erforderlich.");
43 * @returns {Promise<Array<any>>} Eine Liste von Kleidungsstück-Objekten.
44 */
45export async function getWardrobe() {
46 // Ruft alle Schlüssel (IDs) ab, die zum Benutzer gehören.
47 const userWardrobeKeys = (await db.get(`user_wardrobe_keys:${USER_ID}`)) || [];
62// Dies ist der HTTP-Endpunkt deiner Val. Val Town stellt diese Funktion über eine URL bereit.
63// Sie reagiert auf POST-Anfragen (zum Hinzufügen von Items) und GET-Anfragen (zum Abrufen von Items).
64export default async function(req: Request): Promise<Response> {
65 if (req.method === "POST") {
66 try {

molarmessengermain.tsx2 matches

@Dentalabcs•Updated 1 day ago
1export default async function(req: Request): Promise<Response> {
2 if (req.method !== "POST") {
3 return new Response("Only POST allowed", { status: 405 });
66}
67
68async function sendTwilioMessage(to: string, body: string) {
69 const res = await fetch(
70 `https://api.twilio.com/2010-04-01/Accounts/${Deno.env.get("TWILIO_ACCOUNT_SID")}/Messages.json`,

web_kVDHRd4ECFmain.tsx1 match

@dhvanil•Updated 1 day ago
1
2export default async function(req) {
3 return new Response(`undefined`, {
4 headers: { 'Content-Type': 'text/html' }

web_a0FrDgrpnimain.tsx1 match

@dhvanil•Updated 1 day ago
1
2export default async function(req) {
3 return new Response(`undefined`, {
4 headers: { 'Content-Type': 'text/html' }

reactHonoStarterApp.tsx1 match

@Twissy•Updated 1 day ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.