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=540&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 20202 results for "function"(2213ms)

remark-frontmatter-starterplugins.ts4 matches

@arfan•Updated 4 weeks ago
7 * Converts ::: type title\n content ::: to HTML callout divs
8 */
9export function remarkCallout() {
10 return function transformer(tree: Node) {
11 visit(tree, 'text', function visitor(node: any, index: number, parent: any) {
12 // Accept both with and without a title
13 const calloutRegex = /:::\s*([a-zA-Z-]+)(?:\s+(.*?))?\s*\n([\s\S]*?)\n?:::/g;
49
50// Remove rehypeCallout (no-op)
51export function rehypeCallout() {
52 return () => {};
53}

familyAI1 match

@meltedfire•Updated 4 weeks ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function anthropicCompletion(
4 prompt: string,
5) {

my-first-val04_email.tsx2 matches

@stevetestproj•Updated 4 weeks ago
13
14// --------------------- Email Trigger ------------------------
15// Email triggers run the exported function with the email as the argument
16// Learn more about cron triggers: https://docs.val.town/vals/email/
17
18export default async function(e: Email) {
19 console.log(e);
20

Bates_botc_fixtablestructure.ts2 matches

@greasegum•Updated 4 weeks ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3export default async function fixTelegramChatsTable() {
4 console.log("Fixing telegram_chats table...");
5
35}
36
37// Run the function immediately
38fixTelegramChatsTable();

familysendEmail1 match

@meltedfire•Updated 4 weeks ago
1import { email } from "https://esm.town/v/std/email";
2
3export default async function sendEmail(
4 to: string,
5 subject: string,

my-first-val03_cron.tsx3 matches

@stevetestproj•Updated 4 weeks ago
5// ---------------- Val Town Standard Library ----------------
6// Val Town provides limited free hosted services, including
7// functions for sending emails and using OpenAI
8import { email } from "https://esm.town/v/std/email";
9import { OpenAI } from "https://esm.town/v/std/OpenAI";
17
18// --------------------- Cron Trigger ------------------------
19// Cron triggers run the exported function on the specified timer
20// Edit the timer by clicking the clock icon 🕑 above
21// Learn more about cron triggers: https://docs.val.town/vals/cron/
22
23export default async function() {
24 // Use OpenAI provided by Val Town to get weather reccomendation
25 // Experiment with changing the prompt

Bates_botverifytelegramchatsdb.ts2 matches

@greasegum•Updated 4 weeks ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3export default async function setupTelegramChatsTable() {
4 console.log("Setting up telegram_chats table...");
5
37}
38
39// Run the function immediately
40setupTelegramChatsTable();

Bates_botqueries.ts4 matches

@greasegum•Updated 4 weeks ago
6const tableName = "memories";
7
8export async function getAllMemories(): Promise<Memory[]> {
9 const result = await sqlite.execute(
10 `SELECT id, date, text, createdBy, createdDate, tags FROM ${tableName}
23}
24
25export async function createMemory(
26 memory: Omit<Memory, "id">,
27): Promise<Memory> {
51}
52
53export async function updateMemory(
54 id: string,
55 memory: Partial<Omit<Memory, "id">>,
70}
71
72export async function deleteMemory(id: string): Promise<void> {
73 await sqlite.execute(`DELETE FROM ${tableName} WHERE id = ?`, [id]);
74}

remark-frontmatter-starterhead.ts1 match

@arfan•Updated 4 weeks ago
9 * @returns HTML string for the head section
10 */
11export function buildHead(title: string, desc: string, url: string, config: Config): string {
12 const pageTitle = title || config.title;
13 const pageDesc = desc || config.description;

remark-frontmatter-starterconfig.ts2 matches

@arfan•Updated 4 weeks ago
2
3/**
4 * Helper function to resolve stylesheet paths
5 * @param path - Relative path to the stylesheet
6 * @returns Resolved URL string
7 */
8function resolveStylesheet(path: string): string {
9 return import.meta.resolve(`../styles/${path}`).replace("esm.town", "juicy.town");
10}

getFileEmail4 file matches

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

tuna8 file matches

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