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/$%7Bart_info.art.src%7D?q=function&page=2663&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 29322 results for "function"(5624ms)

posthogGitHubStarCapturemain.tsx1 match

@wcbudz•Updated 1 year ago
1import { capturePostHogEvent } from "https://esm.town/v/ianvph/capturePostHogEvent";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return Response.json({ ok: "only post request" });

httpStatusBehaviormain.tsx1 match

@maxm•Updated 1 year ago
11];
12
13export default async function(req: Request): Promise<Response> {
14 const url = new URL(req.url);
15 if (url.pathname === "/") {

resumeRecsmain.tsx1 match

@iamseeley•Updated 1 year ago
3const tokenBucket = new TokenBucket(5, 1/12);
4
5export async function getRecommendations(jobDescription, resume, apiKey) {
6
7 if (!tokenBucket.consume()) {

imgGenUrlmain.tsx1 match

@martinbowling•Updated 1 year ago
6};
7
8export default async function(req: Request): Promise<Response> {
9 let key = new URL(req.url).pathname;
10

AtelierHarfangToRSSmain.tsx2 matches

@vogelino•Updated 1 year ago
4import { DOMParser } from "npm:linkedom@0.16.10";
5
6function response(message: string, contentType = "text/markdown"): Response {
7 const headers = new Headers();
8 headers.set("Access-Control-Allow-Origin", "*");
17}
18
19export default async function(req: Request): Promise<Response> {
20 const url = new URL(`https://atelierharfang.ch`);
21 const html = await fetch(url.toString(), {

TanStackBlogToRSSmain.tsx2 matches

@vogelino•Updated 1 year ago
2import { DOMParser } from "npm:linkedom@0.16.10";
3
4function response(message: string, contentType = "text/markdown"): Response {
5 const headers = new Headers();
6 headers.set("Access-Control-Allow-Origin", "*");
15}
16
17export default async function(req: Request): Promise<Response> {
18 const url = new URL(`https://tanstack.com/blog`);
19 const html = await fetch(url.toString(), {

story_wordcountmain.tsx11 matches

@willthereader•Updated 1 year ago
9
10// Fetch the HTML content of the given URL
11async function fetchHtml(url: string): Promise<string> {
12 const response = await fetch(url, {
13 method: "GET",
31
32// Extract titles by manually parsing the HTML content
33function titleExtractor(html: string): string[] {
34 const regex = /<a[^>]*href="([^"]*threads\/[^"]*)"[^>]*class="[^"]*contentRow-title[^"]*">/g;
35 const titles = [];
44
45// Generates RSS feed links from a base URL
46function urlGenerator(url: string) {
47 return [
48 `${url}threadmarks.rss?threadmark_category=13`,
51}
52
53// Utility function to delay execution
54function delay(ms: number): Promise<void> {
55 return new Promise(resolve => setTimeout(resolve, ms));
56}
57
58// Verifies the validity of each feed URL by checking its contents
59async function urlVerifier(feeds: string[]): Promise<string[]> {
60 const usefulUrls: string[] = [];
61
94
95
96// Main function to execute the scraping process
97async function main() {
98 const baseUrl = "https://forums.spacebattles.com/search/69363141/?t=post&c[content]=thread&c[users]=3ndless&o=date";
99 try {
143}
144
145// Main function to process the flow
146async function main(): Promise<number[]> {
147 const titles = titleExtractor();
148 // console.log("Titles Extracted:", titles); // Debugging log
157}
158
159// Example of how to call the main function and handle the result
160main().then(wordCounts => {
161 console.log("Final Output:", wordCounts);

mdConvertmain.tsx1 match

@nbbaier•Updated 1 year ago
9});
10
11export default async function handler(request: Request) {
12 if (request.method !== "POST") {
13 return html(`

prism_feature_notificationsmain.tsx3 matches

@kishore•Updated 1 year ago
5const confidenceThreshold = 0.8;
6
7function randomlyPickFeature(featuresAboveConfidenceThreshold) {
8 return featuresAboveConfidenceThreshold[Math.floor(Math.random() * featuresAboveConfidenceThreshold.length)];
9}
10
11function getFeatureLink(feature) {
12 const { index } = feature;
13 return `https://thesephist--prism-start-app.modal.run/f/${modelName}/${index}?layout=2`;
14}
15
16export default async function(interval: Interval) {
17 const response = await fetch(dictionaryUrl);
18 const { features } = await response.json();

dailyDadJokemain.tsx1 match

@zhanziyang•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
tuna

tuna9 file matches

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