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=1798&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 22564 results for "function"(1395ms)

webdavServermain.tsx1 match

@pomdtr•Updated 6 months ago
7};
8
9export function serveVals(
10 req: Request,
11 options?: WebdavOptions,

publicKeyPem_examplemain.tsx2 matches

@vladimyr•Updated 6 months ago
50console.log(rsaPublicKeyPem);
51
52function parsePem(pem: string) {
53 pem = pem.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "");
54 return base64pad.baseDecode(pem);
55}
56
57function wrap(input: string, columns = 64) {
58 const reLines = new RegExp(`.{${columns}}`, "g");
59 return input.replace(reLines, (line) => line + "\n");

avidPeachBoamain.tsx3 matches

@vladimyr•Updated 6 months ago
49console.log(publicKeyPem);
50
51function pkiFromPkcs1(pkcs1: ArrayBuffer) {
52 return new pki.PublicKeyInfo({
53 // algorithm: publicKeyInfo.algorithm,
60}
61
62function parsePem(pem: string) {
63 pem = pem.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "");
64 return base64pad.baseDecode(pem);
65}
66
67function wrap(input: string, columns = 64) {
68 const reLines = new RegExp(`.{${columns}}`, "g");
69 return input.replace(reLines, (line) => line + "\r\n");

simpletextmain.tsx1 match

@nbbaier•Updated 6 months ago
84};
85
86export default async function(req: Request): Promise<Response> {
87 const url = new URL(req.url);
88 const pageKeys = (await blob.list()).filter(e => e.key.split("/")[0] === nameSpacePrefix).map(e => e.key);

uniswapV3Positionmain.tsx19 matches

@midnightlightning•Updated 6 months ago
15 * the rate limit more time to reset.
16 */
17async function retryOnRateLimit<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
18 for (let i = 0; i < maxRetries; i++) {
19 try {
32
33/**
34 * This is the main function that looks up information about a Uniswap V3 position.
35 * Given a position ID in the URL, it fetches all the details about that position
36 * including what tokens are involved, their current prices, and whether the position
37 * is currently active.
38 */
39export default async function(req: Request): Promise<Response> {
40 // Get the target token ID from URL path
41 const firstPath = req.url.split("/")[3];
61 address: "0xc36442b4a4522e871399cd717abdd847ab11fe88",
62 abi: parseAbi([
63 "function positions(uint256 tokenId) external view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)",
64 ]),
65 functionName: "positions",
66 args: [tokenId],
67 }));
90 // Fetch info about the two tokens in the position
91 const erc20ABI = parseAbi([
92 "function name() view returns (string)",
93 "function symbol() view returns (string)",
94 "function decimals() view returns (uint8)",
95 ]);
96
102 address: token0,
103 abi: erc20ABI,
104 functionName: "name",
105 },
106 {
107 address: token0,
108 abi: erc20ABI,
109 functionName: "symbol",
110 },
111 {
112 address: token0,
113 abi: erc20ABI,
114 functionName: "decimals",
115 },
116 {
117 address: token1,
118 abi: erc20ABI,
119 functionName: "name",
120 },
121 {
122 address: token1,
123 abi: erc20ABI,
124 functionName: "symbol",
125 },
126 {
127 address: token1,
128 abi: erc20ABI,
129 functionName: "decimals",
130 },
131 ],
147 address: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
148 abi: parseAbi([
149 "function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address)",
150 ]),
151 functionName: "getPool",
152 args: [token0, token1, fee],
153 }));
164 address: poolAddress,
165 abi: parseAbi([
166 "function slot0() external view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)",
167 ]),
168 functionName: "slot0",
169 }));
170 } catch (err) {
211 * to be precise but not so many that it becomes hard to read
212 */
213 function formatPrice(price: BigNumber) {
214 return price.toPrecision(20);
215 }

inventiveAmethystSheepmain.tsx2 matches

@temptemp•Updated 7 months ago
1export default async function(req: Request): Promise<Response> {
2 // Define your .ts file URLs
3 const urls = [
32 };
33
34 // Call the function to concatenate files
35 const concatenatedData = await concatenateFiles();
36

PhoenixProxymain.tsx1 match

@cephalization•Updated 7 months ago
3const HOSTED_PHOENIX_BASE_URL = "https://llamatrace.com";
4// const HOSTED_PHOENIX_BASE_URL = "https://app.phoenix.arize.com";
5export default async function(req: Request) {
6 if (req.method === "OPTIONS") {
7 return new Response(null, {

preciseAquamarineReptilemain.tsx6 matches

@stevekrouse•Updated 7 months ago
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
7
8function App() {
9 const [prompt, setPrompt] = useState("hello llamapalooza");
10 const [code, setCode] = useState("");
21
22 useEffect(() => {
23 function handleKeyDown(e: KeyboardEvent) {
24 if (e.key === "ArrowLeft" && currentIndex > 0) {
25 setCurrentIndex(i => i - 1);
39 }, [currentIndex, history]);
40
41 async function handleSubmit(e: React.FormEvent) {
42 e.preventDefault();
43 setLoading(true);
131}
132
133function client() {
134 createRoot(document.getElementById("root")!).render(<App />);
135}
139}
140
141function extractCodeFromFence(text: string): string {
142 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
143 return htmlMatch ? htmlMatch[1].trim() : text;
144}
145
146export default async function server(req: Request): Promise<Response> {
147 if (req.method === "POST") {
148 const client = new Cerebras();

podcastmain.tsx3 matches

@all•Updated 7 months ago
24];
25
26function App() {
27 const [personality1, setPersonality1] = useState(PRESET_PODCASTS[0].personality1);
28 const [personality2, setPersonality2] = useState(PRESET_PODCASTS[0].personality2);
305}
306
307function client() {
308 createRoot(document.getElementById("root")).render(<App />);
309}
313}
314
315export default async function server(req: Request): Promise<Response> {
316 const url = new URL(req.url);
317

savvyPurpleSpoonbillmain.tsx10 matches

@all•Updated 7 months ago
12}
13
14function App() {
15 const [prompt, setPrompt] = useState("hello llamapalooza");
16 const [code, setCode] = useState("");
31 }, []);
32
33 async function fetchSavedSnippets() {
34 const response = await fetch("/snippets");
35 const snippets = await response.json();
37 }
38
39 async function handleSave() {
40 if (!code) return;
41 const response = await fetch("/snippets", {
49 }
50
51 async function handleDelete(id: number) {
52 const response = await fetch(`/snippets/${id}`, { method: "DELETE" });
53 if (response.ok) {
56 }
57
58 async function handleSubmit(e: React.FormEvent) {
59 e.preventDefault();
60 setLoading(true);
80 }
81
82 function handleBack() {
83 if (currentIndex > 0) {
84 setCurrentIndex(currentIndex - 1);
87 }
88
89 function handleForward() {
90 if (currentIndex < history.length - 1) {
91 setCurrentIndex(currentIndex + 1);
189}
190
191function client() {
192 createRoot(document.getElementById("root")!).render(<App />);
193}
197}
198
199function extractCodeFromFence(text: string): string {
200 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
201 return htmlMatch ? htmlMatch[1].trim() : text;
202}
203
204export default async function server(req: Request): Response {
205 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
206 const KEY = "savvyPurpleSpoonbill";

getFileEmail4 file matches

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

tuna8 file matches

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