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=2338&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 30159 results for "function"(11414ms)

homeControlDevicemain.tsx3 matches

@Vikramhaking•Updated 4 months ago
11};
12
13function HomeControlApp() {
14 const [devices, setDevices] = useState<DeviceState[]>([
15 { id: '1', name: 'Living Room Light', type: 'light', isOn: false },
101}
102
103function client() {
104 createRoot(document.getElementById("root")).render(<HomeControlApp />);
105}
106if (typeof document !== "undefined") { client(); }
107
108export default async function server(request: Request): Promise<Response> {
109 return new Response(`
110 <html>

OpenRouterChatCompletionmain.tsx1 match

@rozek•Updated 4 months ago
4/**** free, but rate-limited access to the OpenRouter API ****/
5
6 export default async function (Request:Request):Promise<Response> {
7 if (Request.method === 'OPTIONS') {
8 return new Response(null, {

OpenRouter_Testmain.tsx1 match

@rozek•Updated 4 months ago
5const Granularity = 15*60*1000
6
7export default async function (Request:Request):Promise<Response> {
8 if (Request.method !== 'GET') {
9 return new Response('Method Not Allowed', { status:405 })

OpenRouterChatCompletionLeadmain.tsx1 match

@rozek•Updated 4 months ago
4/**** how long until "OpenAIChatCompletion" becomes available again? ****/
5
6 export default async function (Request:Request):Promise<Response> {
7 if (Request.method === 'OPTIONS') {
8 return new Response(null, {

lastloginmain.tsx4 matches

@AIWB•Updated 4 months ago
1/** @jsxImportSource npm:hono/jsx */
2async function createSession(email: string, hostname: string) {
3 const { zip } = await import("https://esm.town/v/pomdtr/sql");
4 const { sqlite } = await import("https://esm.town/v/std/sqlite");
23}
24
25async function getSession(sessionID: string, hostname: string) {
26 const { zip } = await import("https://esm.town/v/pomdtr/sql");
27 const { sqlite } = await import("https://esm.town/v/std/sqlite");
52}
53
54async function deleteSession(sessionID: string) {
55 const { sqlite } = await import("https://esm.town/v/std/sqlite");
56
64const OAUTH_COOKIE = "oauth_store";
65
66export function lastlogin(
67 handler: (req: Request) => Response | Promise<Response>,
68) {

growingAquamarineFleamain.tsx10 matches

@SowrovCIV•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function Header() {
6 return (
7 <header className="bg-blue-500 text-white p-4 shadow-md">
20}
21
22function MainBanner() {
23 const [videoLink, setVideoLink] = useState('');
24
63}
64
65function FeaturesSection() {
66 const features = [
67 {
110}
111
112function HowItWorksSection() {
113 return (
114 <section className="bg-gray-100 p-8 rounded-lg shadow-md">
135}
136
137function FAQSection() {
138 const [activeIndex, setActiveIndex] = useState(null);
139
187}
188
189function ContactSection() {
190 const socialLinks = [
191 {
249}
250
251function Footer() {
252 return (
253 <footer className="bg-blue-500 text-white py-6">
278}
279
280function App() {
281 return (
282 <div className="flex flex-col min-h-screen">
296}
297
298function client() {
299 createRoot(document.getElementById("root")).render(<App />);
300}
301if (typeof document !== "undefined") { client(); }
302
303export default async function server(request: Request): Promise<Response> {
304 return new Response(`
305 <html>

tikTokVideoDownloadermain.tsx3 matches

@SowrovCIV•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [videoUrl, setVideoUrl] = useState('');
7 const [downloadLink, setDownloadLink] = useState('');
224};
225
226function client() {
227 createRoot(document.getElementById("root")).render(<App />);
228}
229if (typeof document !== "undefined") { client(); }
230
231export default async function server(request: Request): Promise<Response> {
232 return new Response(`
233 <html>

translatormain.tsx2 matches

@AIWB•Updated 4 months ago
346
347
348 // Helper function to get the supported MIME type
349 function getSupportedMimeType() {
350 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
351 const mimeTypes = [

getLemmyJwtmain.tsx2 matches

@AIWB•Updated 4 months ago
1export async function getLemmyJwt({ instance, username, password }: {
2 instance: string;
3 username: string;
7 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
8 let client = new LemmyHttp(`https://${instance}`, {
9 fetchFunction: fetch,
10 });
11 try {

webhookHandlermain.tsx1 match

@AIWB•Updated 4 months ago
8});
9
10export default async function(req: Request): Promise<Response> {
11 if (req.method === "GET") {
12 return Response.json({ ignored: true });
tuna

tuna9 file matches

@jxnblk•Updated 5 days ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.