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/$%7Burl%7D?q=function&page=20&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 19135 results for "function"(972ms)

orangeSolemultiembed-dood.tsx5 matches

@temptemp•Updated 1 day ago
9};
10
11async function parseHTML(html) {
12 const result = {
13 servers: [],
98}
99
100async function solveCaptcha(predictions, captchaData) {
101 const { captchaId, captcha, promptText } = captchaData;
102 if (!captchaId) throw new Error("captcha_id not found.");
116}
117
118async function solveImageCaptchas(captcha) {
119 await Promise.all(
120 captcha.map(async obj => {
123 formData.append("file", new Blob([blob], { type: "image/jpeg" }), "blob");
124
125 const res = await fetch("https://www.nyckel.com/v1/functions/5m8hktimwukzpb8r/invoke", {
126 method: "POST",
127 body: formData,
144 * @typedef {Object} Env
145 */
146export default async function(request, env, ctx) {
147 const url = new URL(request.url);
148 if (!url.pathname.startsWith("/api")) {
6});
7
8export default async function(interval: Interval) {
9 // Initializing a client
10 const notion = new Client({

getDatagetData.tsx1 match

@eduardoamaral•Updated 1 day ago
1// @val-town/api
2export default async function(req: Request): Promise<Response> {
3 return Response.json({
4 status: "ok",

ColosseumcheckAvail.tsx12 matches

@lirenxn•Updated 1 day ago
11
12**/
13export async function checkAvail({ type, date, debug, notify }: {
14 type: string;
15 date: string;
26 ];
27 const USER_AGENT = UA_LIST[Math.floor(Math.random() * UA_LIST.length)];
28 function getHeaders(opts) {
29 const { cookies, referer } = opts;
30 const cookieObj = cookies
74 },
75 };
76 function findThatScript(htmlText: string) {
77 const $ = cheerio.load(htmlText);
78 const firstBodyScript = $("body script")[0];
92 return res;
93 }
94 async function safeEvalOctofenceTokenValTown(script: string) {
95 const res = await fetch("https://api.val.town/v1/eval", {
96 method: "POST",
106 return await res.json();
107 }
108 async function getOctofenceToken(htmlText: string) {
109 const script = findThatScript(htmlText);
110 // octofence_token
112 return octofence_token;
113 }
114 function fetchCalendar(
115 id: string,
116 month: number,
137 });
138 }
139 async function getToken(id: string, thisMonth: number, eventPageUrl: string) {
140 const resWithAuthToken = await fetchCalendar(id, thisMonth, eventPageUrl);
141 const htmlWithAuth = await resWithAuthToken.text();
159 return token;
160 }
161 function fetchDateSlots(
162 date: string,
163 id: string,
176 });
177 }
178 function extractAvailSlots(html: string): Array<{
179 time: string;
180 tickets: number;
212 debug && console.log("Cal html: ", calThisMonth);
213 // Parse cal
214 function extractAvailDates(calHtml: string) {
215 const $ = cheerio.load(calHtml);
216 const availableDatesEL = $(".available.active").toArray();
222 ];
223 debug && console.log("Avail dates: ", availableDates);
224 function isDateAvail(availableDates, date) {
225 const compare = (d) => {
226 const dArr = d.split("/");
241 coupleSlots = slots.filter((s) => s.tickets >= 2);
242 if (coupleSlots.length > 0) {
243 function getCartCartLink(
244 productId: string,
245 performanceId: string,

ColosseumrunCheckUnderground.tsx1 match

@lirenxn•Updated 1 day ago
1import { checkAvail } from "https://esm.town/v/lirenxn/checkAvail";
2
3export async function runCheckUnderground() {
4 const result = await checkAvail({
5 type: "underground",

ColosseumrunCheckUnderground2.tsx1 match

@lirenxn•Updated 1 day ago
3import { set } from "https://esm.town/v/std/set?v=11";
4
5export async function runCheckUnderground2() {
6 const result = await checkAvail({
7 type: "underground",

ColosseummailMeTheLink.tsx1 match

@lirenxn•Updated 1 day ago
11
12**/
13export function mailMeTheLink({ calLink, date, type, slots }: {
14 calLink: string;
15 date: string;

nell-parker-townindex.ts1 match

@parkerdavis•Updated 1 day ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

Work_Time_Calculator_2main.tsx7 matches

@willthereader•Updated 1 day ago
1function parseTimeRanges(daySchedule) {
2 // console.log(`Parsing schedule: ${daySchedule}`);
3 const timeRanges = daySchedule.match(/(\d{1,2}(?::\d{2})?(?:am|pm)?)/g);
53}
54
55function convertTo24HourFormat(time) {
56 if (!time) {
57 throw new Error("Invalid time input: time is undefined or empty");
91}
92
93function calculateDuration(day, startTime, endTime) {
94 console.log(`calculateDuration: Calculating duration on ${day} from ${startTime} to ${endTime}`);
95 const start24 = convertTo24HourFormat(startTime);
112}
113
114function calculateDailyTotal(day, parsedSchedule) {
115 console.log(`calculateDailyTotal: Calculating daily total for ${day}`, parsedSchedule);
116 let totalMinutes = 0;
130}
131
132function calculateWeeklyTotal(day, dailyTotals) {
133 console.log(`calculateWeeklyTotal: Calculating weekly total for daily totals for ${day} is`, dailyTotals);
134 let totalHours = 0;
148}
149
150function isValidDay(day) {
151 const validDays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
152 return validDays.includes(day.charAt(0).toUpperCase() + day.slice(1).toLowerCase());
153}
154
155function calculateWorkTime(schedule) {
156 const dailyTotals = [];
157 const scheduleArray = schedule.split("\n").filter(Boolean);
1export default async function handleRequest(request: Request): Promise<Response> {
2 // this is a function called handleRequest that is exported for use elsewhere and accepts one input
3 const { url } = await request.json();
4 // the variable url cannot be changed and to the code to wait until the HTTP data is read and and turned into JSON

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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",