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=2479&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 28783 results for "function"(2284ms)

linkInBioTemplatemain.tsx6 matches

@rasputinkaiser•Updated 9 months ago
5// ... (previous AuthContext, AuthProvider, and useAuth remain the same)
6
7function App() {
8 // ... (App component remains the same)
9}
10
11function Home({ theme }) {
12 const { user } = useAuth();
13 const isDark = theme === 'dark';
51}
52
53function PromptGenerator() {
54 const [prompt, setPrompt] = useState('');
55
80}
81
82function Tools({ theme }) {
83 const isDark = theme === 'dark';
84 const tools = [
102}
103
104function Gallery({ theme }) {
105 const isDark = theme === 'dark';
106 const [filter, setFilter] = useState('all');
209};
210
211// ... (client and server functions remain the same)

finalScrapermain.tsx3 matches

@rochambeau314•Updated 9 months ago
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9function App() {
10 const [link, setLink] = useState("");
11 const [results, setResults] = useState(null);
81}
82
83function client() {
84 createRoot(document.getElementById("root")).render(<App />);
85}
89}
90
91async function server(request: Request): Promise<Response> {
92 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {
93 const { link } = await request.json();

hasWebsiteChangedmain.tsx1 match

@browserbase•Updated 9 months ago
7import slugify from "npm:slugify";
8
9export async function hasWebsiteChanged(url: string, threshold = 0.5) {
10 const slug = slugify(url);
11

httpApiScreenshotPageExamplemain.tsx1 match

@browserbase•Updated 9 months ago
3import Jimp from "npm:jimp";
4
5export async function blobReadPictureExample(request: Request): Promise<Response> {
6 const searchParams = new URL(request.url).searchParams;
7 const url = searchParams.get("url") || "https://www.browserbase.com";

browserbaseUtilsmain.tsx2 matches

@browserbase•Updated 9 months ago
5}
6
7export async function loadPageContent(url: string, options: LoadPageContentOptions = { textContent: false }) {
8 const browser = await puppeteer.connect({
9 browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
33}
34
35export async function screenshotPage(url: string, options: ScreenshotPageOptions = { fullPage: true }) {
36 const browser = await puppeteer.connect({
37 browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,

websiteChangeDetectionToolmain.tsx1 match

@browserbase•Updated 9 months ago
2import { email } from "https://esm.town/v/std/email?v=12";
3
4export default async function(interval: Interval) {
5 const bbLandingChanged = await hasWebsiteChanged("https://www.browserbase.com");
6 console.log("bbLandingChanged", bbLandingChanged);

sqliteExplorerAppREADME.md1 match

@peterhartree•Updated 9 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

stiffCoffeeLampreyREADME.md1 match

@maxm•Updated 9 months ago
11import { email } from "https://esm.town/v/std/email?v=13";
12
13export default async function (interval: Interval) {
14 const bookingInfo = await resyBot( {
15 slug: 'amaro-bar',

resyBotREADME.md1 match

@maxm•Updated 9 months ago
11import { email } from "https://esm.town/v/std/email?v=13";
12
13export default async function (interval: Interval) {
14 const bookingInfo = await resyBot( {
15 slug: 'amaro-bar',

frozenSapphireIguanamain.tsx9 matches

@rochambeau314•Updated 9 months ago
8import { createRoot } from "https://esm.sh/react-dom/client";
9
10function App() {
11 const [origin, setOrigin] = useState("");
12 const [results, setResults] = useState([]);
237}
238
239function client() {
240 createRoot(document.getElementById("root")).render(<App />);
241}
245}
246
247export default async function server(request: Request): Promise<Response> {
248 console.log("Received request:", request.url);
249 const url = new URL(request.url);
373 });
374 } catch (error) {
375 console.error("Error in server function:", error);
376 return new Response(JSON.stringify({ error: "An error occurred while calculating travel times", details: error.message }), {
377 headers: { "Content-Type": "application/json" },
397}
398
399async function findNearest(origin: string, locations: any[], apiKey: string): Promise<any> {
400 console.log(`Finding nearest location among ${locations.length} options`);
401 const batchSize = 25; // Google Maps API typically allows up to 25 destinations per request
439}
440
441async function getDrivingTime(origin: string, destination: string, apiKey: string, arrivalTime?: string, arrivalDay?: string): Promise<string> {
442 let directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${encodeURIComponent(origin)}&destination=${encodeURIComponent(destination)}&mode=driving&key=${apiKey}`;
443
460}
461
462async function getTransitTime(origin: string, destination: string, apiKey: string): Promise<string> {
463 const directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${encodeURIComponent(origin)}&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
464
475}
476
477async function getZipCode(address: string, apiKey: string): Promise<string> {
478 const geocodeUrl = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(address)}&key=${apiKey}`;
479 const response = await fetch(geocodeUrl);
490}
491
492function getNextDayOfWeek(date: Date, dayOfWeek: string): Date {
493 const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
494 const targetDay = days.indexOf(dayOfWeek.toLowerCase());

getFileEmail4 file matches

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

tuna8 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.