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=2693&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 28734 results for "function"(7956ms)

add_to_notion_w_aimain.tsx9 matches

@nerdymomocat•Updated 1 year ago
35});
36
37function createPrompt(title, description, properties) {
38 let prompt =
39 "You are processing content into a database. Based on the title of the database, its properties, their types and options, and any existing descriptions, infer appropriate values for the fields:\n";
80}
81
82function processProperties(jsonObject) {
83 const properties = jsonObject.properties;
84 const filteredProps = {};
111}
112
113async function get_and_save_notion_db_processed_properties(databaseId)
114{
115 const response = await notion.databases.retrieve({ database_id: databaseId });
122}
123
124async function get_notion_db_info(databaseId) {
125 databaseId = databaseId.replaceAll("-", "");
126 let db_info = null;
137}
138
139async function get_and_save_notion_db_info(databaseId) {
140 databaseId = databaseId.replaceAll("-", "");
141 let db_info = await get_and_save_notion_db_processed_properties(databaseId);
144}
145
146function createZodSchema(filteredProps) {
147 const schemaObject = {};
148
193}
194
195function convertToNotionProperties(responseValues, filteredProps) {
196 const notionProperties = {};
197
268}
269
270async function process_text(dbid, text) {
271 const db_info = await get_notion_db_info(dbid);
272 const processed_message = await client.chat.completions.create({
283}
284
285async function addToNotion(databaseId, text) {
286 databaseId = databaseId.replaceAll("-", "");
287 const properties = await process_text(databaseId, text);

untitled_roseGuanacomain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { html } from "https://esm.town/v/stevekrouse/html";
2
3export default async function(req: Request): Promise<Response> {
4 // return new Response("<h1>Hello FRC!</h1>", { headers: {
5 // "Content-Type": "text/html"

trendingreposmain.tsx7 matches

@jamesw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// Helper function to format the date for GitHub API query
4function formatDate(daysAgo: number): string {
5 const date = new Date();
6 date.setDate(date.getDate() - daysAgo);
8}
9
10// Function to fetch top GitHub repositories based on stars and creation date
11async function topGitHubRepos(stars: number, daysAgo: number, timeframeDescription: string) {
12 const date = formatDate(daysAgo);
13 const query = `stars:>${stars} created:>${date}`;
23}
24
25// Function to get combined information for different criteria
26export async function getTopReposByCriteria() {
27 const reposLastWeek = await topGitHubRepos(1000, 7, "Created Last Week"); // Last week, over 1000 stars
28 const reposLastMonth = await topGitHubRepos(3000, 30, "Created Last Month"); // Last month, over 3000 stars
33}
34
35// Call the function to get and print the information
36getTopReposByCriteria().then(console.log);

prune_valmain.tsx1 match

@saolsen•Updated 1 year ago
1export async function prune_val(
2 val_id: string,
3 keep_versions: number[],

manifold_daily_loan_collectormain.tsx1 match

@case•Updated 1 year ago
1export default async function() {
2 const res = await fetch("https://api.manifold.markets/request-loan", {
3 headers: {

untitled_indigoMolluskmain.tsx2 matches

@willthereader•Updated 1 year ago
6import { post_idFetcher } from "https://esm.town/v/willthereader/post_idFetcher";
7
8export async function Sendingemail() {
9 // console.log("Sendingemail function called");
10 try {
11 let lastRunDate = new Date("2023-11-10T19:27:25.547Z");

react_maplibremain.tsx1 match

@hfu•Updated 1 year ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

untitled_beigeLemurmain.tsx1 match

@yuiseki•Updated 1 year ago
20};
21
22export default async function(req: Request) {
23 return new Response(
24 renderToString(

twemojimain.tsx4 matches

@stevedylandev•Updated 1 year ago
10const UFE0Fg = /\uFE0F/g;
11
12export function getIconCode (char: string) {
13 return toCodePoint(!char.includes(U200D) ? char.replace(UFE0Fg, "") : char);
14}
15
16function toCodePoint (unicodeSurrogates: string) {
17 const r = [];
18 let c = 0;
56const emojiCache: Record<string, Promise<string>> = {};
57
58export async function loadEmoji (type: keyof typeof apis, code: string) {
59 const key = `${type}:${code}`;
60
69 const api = apis[type];
70
71 if (typeof api === "function") {
72 return (emojiCache[key] = fetch(api(code)).then(async r => r.text()));
73 }

powderNotifyCronmain.tsx1 match

@chet•Updated 1 year ago
1import { powderNotify } from "https://esm.town/v/chet/powderNotify";
2
3export default async function(interval: Interval) {
4 await Promise.all([
5 powderNotify("Truckee, CA"),

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.