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/?q=function&page=2406&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 28335 results for "function"(4352ms)

oddSalmonCrayfishmain.tsx4 matches

@matthamlin•Updated 8 months ago
12]
13
14function shuffleArray(arr) {
15 return arr.toSorted(() => {
16 return Math.random() > 0.5 ? 1 : -1
26];
27
28function reducer(state) {
29 return state + 1;
30}
31
32function App() {
33 let [count, dispatch] = useReducer(reducer, 0);
34
43}
44
45export function renderApp() {
46 let root = createRoot(document.getElementById("root")!);
47

bbrunmain.tsx2 matches

@kenbarrett•Updated 8 months ago
2
3/**
4 * You can supply these options as a second argument to the `proxy` function.
5 * These options are used to configure the frontend.
6 */
135
136export const proxy = (url: string, options?: FrontendOptions) => {
137 return async function(req: Request): Promise<Response> {
138 if (req.method === "GET") {
139 return renderFrontend(url, options);

BrowserbaseFetcherFromURLmain.tsx1 match

@willthereader•Updated 8 months ago
4const TIMEOUT = 30000; // 30 seconds timeout
5
6export default async function server(request: Request): Promise<Response> {
7 // Array of URLs to scrape
8 const urls = [

entireGoldLarkmain.tsx1 match

@nlnhsr•Updated 8 months ago
128
129export const service = (boardUrl: string, options?: ServiceOptions) => {
130 return async function(req: Request): Promise<Response> {
131 const url = new URL(req.url);
132 const path = url.pathname;

openaiproxymain.tsx2 matches

@roadlabs•Updated 8 months ago
18
19type User = { id: string; username: string; tier: string };
20export default async function(req: Request): Promise<Response> {
21 // Ensure only allowed pathnames are used
22 const { pathname, search } = new URL(req.url);
82
83// Free users are limited to gpt-4o-mini. Limit pro users to 10 expensive model requests.
84async function limitFreeModel(req: Request, user: User) {
85 const input = await req.json();
86 let model = "gpt-4o-mini";

entireGoldLarkmain.tsx1 match

@odicho•Updated 8 months ago
128
129export const service = (boardUrl: string, options?: ServiceOptions) => {
130 return async function(req: Request): Promise<Response> {
131 const url = new URL(req.url);
132 const path = url.pathname;

bbrunmain.tsx2 matches

@yejun•Updated 8 months ago
2
3/**
4 * You can supply these options as a second argument to the `proxy` function.
5 * These options are used to configure the frontend.
6 */
135
136export const proxy = (url: string, options?: FrontendOptions) => {
137 return async function(req: Request): Promise<Response> {
138 if (req.method === "GET") {
139 return renderFrontend(url, options);

bbrunREADME.md1 match

@yejun•Updated 8 months ago
13must contain your board server API key.
14
15To use, create an HTTP val, then import the `proxy` function from this script and call it like this:
16
17```ts

bbrunREADME.md1 match

@kenbarrett•Updated 8 months ago
13must contain your board server API key.
14
15To use, create an HTTP val, then import the `proxy` function from this script and call it like this:
16
17```ts

Splinemain.tsx3 matches

@mrsnor•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [SplineComponent, setSplineComponent] = useState(null);
7 const [error, setError] = useState(null);
50}
51
52function client() {
53 createRoot(document.getElementById("root")).render(<App />);
54}
56if (typeof document !== "undefined") { client(); }
57
58async function server(request: Request): Promise<Response> {
59 return new Response(
60 `

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.