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=1627&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 19268 results for "function"(2105ms)

devtoolsmain.tsx1 match

@iamseeley•Updated 10 months ago
2import { api } from "https://esm.town/v/pomdtr/api";
3
4export function devtools(handler: (req: Request) => Response | Promise<Response>, options?: {
5 val?: {
6 handle: string;

sendSMSmain.tsx2 matches

@iamseeley•Updated 10 months ago
8};
9
10export async function sendSMS(phoneNumber: string, message: string, carrier: string): Promise<void> {
11 const carrierDomain = carriers[carrier.toLowerCase()];
12 if (!carrierDomain) {
22 text: message,
23 });
24 console.log('Email function returned:', result);
25 console.log('SMS sent successfully');
26 } catch (error) {

Work_Time_Calculatormain.tsx12 matches

@willthereader•Updated 10 months ago
1function convertTo24HourFormat(time) {
2 if (!time) {
3 console.error("Invalid time input:", time);
17}
18
19function parseTimeRanges(daySchedule) {
20 console.log(`Parsing schedule: ${daySchedule}`);
21 const timeRanges = daySchedule.match(/(\d{1,2}:\d{2}(?:am|pm)?)/g);
54}
55
56function calculateDuration(startTime, endTime) {
57 console.log(`Calculating duration from ${startTime} to ${endTime}`);
58 const start24 = convertTo24HourFormat(startTime);
73}
74
75function calculateDailyTotal(parsedSchedule) {
76 console.log(`Calculating daily total for schedule:`, parsedSchedule);
77 let totalMinutes = 0;
89}
90
91function calculateWeeklyTotal(dailyTotals) {
92 console.log(`Calculating weekly total for daily totals:`, dailyTotals);
93 let totalHours = 0;
107}
108
109function calculateWorkTime(schedule) {
110 const dailyTotals = [];
111 const scheduleArray = schedule.split("\n").filter(Boolean);
155calculateWorkTime(schedule);
156
157/*function testConvertTo24HourFormat() {
158 console.assert(convertTo24HourFormat("10:18am") === "10:18", `Test failed for "10:18am"`);
159 console.assert(convertTo24HourFormat("12:35pm") === "12:35", `Test failed for "12:35pm"`);
167}
168
169function testParseTimeRanges() {
170 const result1 = parseTimeRanges("10:18am-12:35pm lunch 1:25pm-6:38pm");
171 console.assert(result1.length === 2, `Test failed for length of result1`);
194}
195
196function testCalculateDuration() {
197 const duration1 = calculateDuration("10:18am", "12:35pm");
198 console.assert(duration1.hours === 2 && duration1.minutes === 17, `Test failed for duration 10:18am-12:35pm`);
210}
211
212function testCalculateDailyTotal() {
213 const parsedSchedule1 = [
214 { start: "10:18am", end: "12:35pm" },
229}
230
231function testCalculateWeeklyTotal() {
232 const dailyTotals = [
233 { hours: 7, minutes: 30 },
243}
244
245function runTests() {
246 try {
247 testConvertTo24HourFormat();

reportCommentNotificationmain.tsx1 match

@parkerdavis•Updated 10 months ago
5const baseUrl = "agave-astro.netlify.app";
6
7export default async function(req: Request): Promise<Response> {
8 if (req.method === "POST") {
9 const comment = await req.json() as Comment;

newCommentNotificationmain.tsx1 match

@parkerdavis•Updated 10 months ago
5const baseUrl = "agave-astro.netlify.app";
6
7export default async function(req: Request): Promise<Response> {
8 if (req.method === "POST") {
9 const comment = await req.json() as Comment;

sqliteExplorerAppREADME.md1 match

@hlobil•Updated 10 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

SongTaggermain.tsx1 match

@benlenarts•Updated 10 months ago
125});
126
127async function getToken(c) {
128 const state = c.req.query("state") as string;
129 const authData = await db.select().from(table).where(eq(table.id, state)).limit(1);

dateme_faqmain.tsx1 match

@vawogbemi•Updated 10 months ago
6let linkClass = "text-sky-600 hover:text-sky-500";
7
8export default function FAQ(c) {
9 return c.html(
10 <Layout activeTab={new URL(c.req.url).pathname}>

sqliteExplorerAppREADME.md1 match

@burcs•Updated 10 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

processTextInChunksmain.tsx2 matches

@yawnxyz•Updated 10 months ago
3
4
5export async function processTextInChunks(inputText, processFn = async (text) => console.log(text), config = {}) {
6 const {
7 chunkLength = 1000,
49
50// just gives information about the chunks; doesn't actually do anything!
51export function preprocessTextChunks(inputText, config = {}) {
52 const {
53 chunkLength = 1000,

getFileEmail4 file matches

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