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=1642&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 21635 results for "function"(1508ms)

get_gemini_modelsmain.tsx1 match

@spinningideas•Updated 6 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 6 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 6 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();

whoIsHiringmain.tsx3 matches

@spinningideas•Updated 6 months ago
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
8
9function App() {
10 const tabs = { "/": "Home", "/about": "About" };
11 const [activeTab, setActiveTab] = useState("/");
335}
336
337function ServerApp() {
338 return (
339 <html>
358}
359
360export default async function(req: Request): Promise<Response> {
361 const url = new URL(req.url);
362 if (url.pathname === "/api/stories") {

spanishPoeticClockmain.tsx5 matches

@manyone•Updated 6 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function formatTime() {
7 const now = new Date();
8 const hours = now.getHours();
97];
98
99function getRandomPoem(time) {
100 const poem = POEMS[Math.floor(Math.random() * POEMS.length)];
101 return {
105}
106
107function SpanishTimePoemApp() {
108 const time = formatTime();
109 const { spanishPoem, englishPoem } = getRandomPoem(time);
139}
140
141function client() {
142 createRoot(document.getElementById("root")).render(<SpanishTimePoemApp />);
143}
144if (typeof document !== "undefined") { client(); }
145
146export default async function server(request: Request): Promise<Response> {
147 const { blob } = await import("https://esm.town/v/std/blob");
148 const time = formatTime();

sqliteExplorerAppmain.tsx3 matches

@granin•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [query, setQuery] = useState("");
7 const [table, setTable] = useState("val_town_agent_specifications");
129}
130
131window.initClient = function() {
132 const rootElement = document.getElementById("root");
133 if (rootElement) {
141}
142
143export default async function server(request: Request): Promise<Response> {
144 // Handle GET requests by serving the HTML
145 if (request.method === 'GET') {

sqliteExplorerAppREADME.md1 match

@granin•Updated 6 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

sqlitemain.tsx4 matches

@granin•Updated 6 months ago
4import { nanoid } from "https://esm.sh/nanoid";
5
6function App() {
7 const [specId, setSpecId] = useState("");
8 const [implementationResult, setImplementationResult] = useState(null);
84}
85
86window.initClient = function() {
87 const rootElement = document.getElementById("root");
88 if (rootElement) {
96}
97
98export default async function server(request: Request): Promise<Response> {
99 // Handle GET requests by serving the HTML
100 if (request.method === 'GET') {
2133. Ensure the implementation is under 15KB
2144. Follow Unix philosophy: do one thing well
2155. Use functional programming principles
2166. Provide clear, concise, and efficient code
2177. MUST return a valid JSON object with implementation details

thrillingAmaranthKiwimain.tsx11 matches

@bladesquad•Updated 6 months ago
162const GOOGLE_MAPS_API_KEY = 'AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw';
163
164// Utility Functions
165function calculateDistance(lat1, lon1, lat2, lon2) {
166 const R = 6371; // Radius of the earth in km
167 const dLat = (lat2 - lat1) * Math.PI / 180;
175}
176
177// Geocoding Utility Function
178async function geocodeLocation(location) {
179 const algerianLocations = {
180 'alger': { lat: 36.7538, lng: 3.0588, region: 'Alger' },
242
243// Cat Report Form Component
244function CatReportForm() {
245 const [report, setReport] = useState({
246 location: '',
307
308// Veterinary Contacts Component
309function VeterinaryContacts() {
310 const mapRef = useRef(null);
311 const [location, setLocation] = useState('');
380 // Find nearest vets based on location
381 useEffect(() => {
382 async function findNearestVets() {
383 if (!locationCoords) {
384 setNearestVets(EMERGENCY_VETERINARY_CONTACTS);
544
545// Main App Component
546function App() {
547 const [view, setView] = useState('report');
548
588}
589
590// Rendering Function
591function renderApp() {
592 const rootElement = document.getElementById("root");
593 if (!rootElement) return;
621
622// Server Response Handler
623export default async function server(request: Request): Promise<Response> {
624 return new Response(`
625 <!DOCTYPE html>

redditNewmain.tsx1 match

@alexdmejias•Updated 6 months ago
13};
14
15export default async function server(req: Request) {
16 const a = await redditNew({ r: "astoria" });
17 console.log("wasd");

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

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