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/$2?q=function&page=2871&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 33907 results for "function"(10412ms)

captivatingLimeGuanmain.tsx6 matches

@mahtabtattur•Updated 7 months ago
73
74// Plant Identification Service (Simulated with more sophisticated matching)
75async function identifyPlant(imageFile) {
76 return new Promise((resolve, reject) => {
77 // Simulate API call with image processing
106
107// Simulated image similarity calculation
108function calculateImageSimilarity(imageData, plantType) {
109 // In a real scenario, this would use machine learning techniques
110 const randomFactor = Math.random() * 0.4 + 0.3; // Base randomness
119}
120
121function PlantDetailCard({ plant, confidence }) {
122 return (
123 <div className="bg-white shadow-lg rounded-2xl p-6 animate-slide-up">
159}
160
161function PlantIdentifierApp() {
162 const [selectedImage, setSelectedImage] = useState(null);
163 const [plantInfo, setPlantInfo] = useState(null);
336}
337
338function client() {
339 createRoot(document.getElementById("root")).render(<PlantIdentifierApp />);
340}
341if (typeof document !== "undefined") { client(); }
342
343export default async function server(request: Request): Promise<Response> {
344 return new Response(`
345 <html>

yc_findermain.tsx5 matches

@stevekrouse•Updated 7 months ago
23`;
24
25function Hero() {
26 return (
27 <div className="hero">
32}
33
34function HowItWorks() {
35 return (
36 <div className="how-it-works">
53}
54
55function App() {
56 const [ycCompanies, setYcCompanies] = useState<YCCompany[]>([]);
57 const [mergedData, setMergedData] = useState<any[]>([]);
217}
218
219function client() {
220 createRoot(document.getElementById("root")!).render(<App />);
221}
225}
226
227export default async function server(request: Request): Promise<Response> {
228 const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229 const url = new URL(request.url);

getWeatherREADME.md1 match

@hercialvitalis21•Updated 7 months ago
1## Get Weather
2
3Simple function to get weather data from the free [wttr.in](https://wttr.in/:help) service.
4
5```ts

getWeathermain.tsx1 match

@hercialvitalis21•Updated 7 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(location: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}

weatherGPTmain.tsx1 match

@serkanokur•Updated 7 months ago
31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}

sonnetmain.tsx2 matches

@manyone•Updated 7 months ago
1import Anthropic from "npm:@anthropic-ai/sdk";
2
3export default async function generatePoem() {
4 try {
5 // Retrieve the Anthropic API key from environment variables
74}
75
76// If this script is run directly, execute the function
77if (import.meta.main) {
78 console.log("🚀 Script Execution Started");

scraper_templateREADME.md1 match

@vawogbemi•Updated 7 months ago
133. Adjust the if statement to detect changes and update your blob
14
154. Craft a message to be sent with `sendNotification()` function

get_gemini_modelsmain.tsx1 match

@spinningideas•Updated 7 months ago
7}
8
9export async function getGeminiModels(): Promise<GeminiModel[]> {
10 try {
11 const API_KEY = process.env.GEMINI_API_KEY;

sqliteExplorerAppREADME.md1 match

@spinningideas•Updated 7 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

geocodemain.tsx3 matches

@spinningideas•Updated 7 months ago
10import debounce from "https://esm.sh/lodash.debounce";
11
12function App() {
13 const [query, setQuery] = useState("");
14 const [suggestions, setSuggestions] = useState([]);
112}
113
114function client() {
115 createRoot(document.getElementById("root")).render(<App />);
116}
120}
121
122async function server(request: Request): Promise<Response> {
123 if (request.method === "POST" && new URL(request.url).pathname === "/geocode") {
124 const { query } = await request.json();

discordWebhook2 file matches

@stevekrouse•Updated 1 week ago
Helper function to send Discord messages
tuna

tuna9 file matches

@jxnblk•Updated 1 month 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.