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/image-url.jpg%20%22Image%20title%22?q=function&page=25&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 18861 results for "function"(983ms)

subdomainstech.tsx1 match

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

subdomainsstudy.tsx1 match

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

subdomainsrag.tsx1 match

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

subdomainslist.tsx1 match

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

subdomainstodo.tsx1 match

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

untitled-6989new-file-4295.tsx1 match

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

Townieusage-dashboard.ts4 matches

@valdottown•Updated 1 day ago
4
5// Basic Auth middleware
6async function basicAuthMiddleware(req: Request): Promise<Response | null> {
7 const realm = "Usage Dashboard";
8 const unauthorizedResponse = new Response("Unauthorized", {
50}
51
52export default async function(req: Request) {
53 // Check authentication first
54 const authResponse = await basicAuthMiddleware(req);
288
289 <script>
290 document.addEventListener('DOMContentLoaded', function() {
291 // Add click event listeners to all tabs
292 document.querySelectorAll('.tab').forEach(tab => {
293 tab.addEventListener('click', function() {
294 const tabId = this.getAttribute('data-tab');
295

glastonewsindex.ts5 matches

@bensomething•Updated 1 day ago
9
10// ======= Fetch HTML with Improved Retry =======
11async function fetchHtmlWithRetry(url, options = {}, retries = 5, delay = 1000) {
12 for (let i = 0; i < retries; i++) {
13 try {
71
72// ======= Fetch News =======
73async function fetchNews() {
74 const url = "https://glastonburyfestivals.co.uk/news/";
75 try {
94
95// ======= Fetch Your Own Recent Bluesky Post Titles =======
96async function fetchOwnRecentPostTitles(agent, handle, limit = 100) {
97 const feed = await agent.getAuthorFeed({ actor: handle, limit });
98 return feed.data.feed.map(item => item.post.record.text);
100
101// ======= Fetch Embed Data =======
102async function fetchEmbedData(url) {
103 try {
104 const html = await fetchHtmlWithRetry(url);
168
169// ======= Main Bot =======
170async function main() {
171 try {
172 await agent.login({

untitled-5581lambdaCalculus.ts11 matches

@FireCrystalScribe•Updated 1 day ago
19// c: cutoff - indices >= c are shifted, < c are bound locally and untouched
20// term: the term to process
21function shift(d: number, c: number, term: Term): Term {
22 switch (term.type) {
23 case "var":
39// s: the replacement term
40// term: the term in which substitution occurs
41function substitute(j: number, s: Term, term: Term): Term {
42 switch (term.type) {
43 case "var":
63// 2. substitute(0, <shifted_t2>, t1): Replace Var(0) in t1 with the shifted t2.
64// 3. shift(-1, 0, <result>): Decrement free variables in the result as the outer lambda binder is removed.
65function betaReduce(absBody: Term, arg: Term): Term {
66 const shiftedArg = shift(1, 0, arg);
67 const substitutedBody = substitute(0, shiftedArg, absBody);
72// Single Step Reducer (Normal Order)
73// --------------------------
74function reduceStep(term: Term): Term | null {
75 switch (term.type) {
76 case "app":
79 return betaReduce(term.func.body, term.arg);
80 }
81 // Rule 2: t1 t2 ---> t1' t2 (Reduce function part)
82 const reducedFunc = reduceStep(term.func);
83 if (reducedFunc) {
107// Full Reducer
108// --------------------------
109function reduce(term: Term, maxSteps: number = 100, verbose: boolean = false): Term {
110 let currentTerm = term;
111 if (verbose) console.log(`Reducing: ${termToString(currentTerm)}`);
124
125// --------------------------
126// toString Function
127// --------------------------
128const baseVarNames = "xyzabcdefghijklmnopqrstuvw";
129
130function generateVarName(depth: number, usedNames: string[]): string {
131 let name: string;
132 let tempDepth = depth;
149}
150
151function termToStringInternal(term: Term, boundNames: string[]): string {
152 switch (term.type) {
153 case "var":
183}
184
185function termToString(term: Term): string {
186 return termToStringInternal(term, []);
187}
256const Y = Abs(App(Y_inner, Y_inner));
257
258// A sample function F (e.g. identity I)
259const F_for_Y_test = I;
260const test_Y_F = App(Y, F_for_Y_test);

templateTwitterAlertREADME.md2 matches

@noumanshakeel82•Updated 1 day ago
46- Key: `mentionsDiscord`
47- Value: Your Discord webhook URL.
48Notifications will be sent using this function:
49
50```ts
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

getFileEmail4 file matches

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

tuna8 file matches

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