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=2673&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 29291 results for "function"(5318ms)

linkInBioTemplatemain.tsx1 match

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

cron_client_react_forkmain.tsx5 matches

@stevekrouse•Updated 1 year ago
5import react_http from "https://esm.town/v/stevekrouse/react_http?v=6";
6
7export default function(req: Request) {
8 const url = new URL(req.url);
9 if (req.method === "GET" && url.pathname === "/") {
22}
23
24export function App() {
25 const browserTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
26 const [loading, setLoading] = useState(false);
27 const [cron, setCron] = useState("0 16 * * 1-5");
28 const onSubmit: React.FormEventHandler<HTMLFormElement> = async function(e) {
29 e.preventDefault();
30 setLoading(true);
84);
85
86function Cron({ cron, timezone }) {
87 let translation;
88 try {
107}
108
109async function compile(req: Request) {
110 const form = await req.formData();
111 const description = form.get("description") as string;

react_httpmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export default function({ component, sourceURL, head }: { component: Function; sourceURL: string; head?: string }) {
2 return new Response(
3 `<html>

cron_client_side_script_forkmain.tsx2 matches

@stevekrouse•Updated 1 year ago
78});
79
80function clientScript() {
81 // Set the timezone input
82 const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
96}
97
98function Cron({ cron, timezone }) {
99 let translation;
100 try {

translatormain.tsx2 matches

@yawnxyz•Updated 1 year ago
291
292
293 // Helper function to get the supported MIME type
294 function getSupportedMimeType() {
295 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
296 const mimeTypes = [

getWeathermain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(location: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}

harlequinCobramain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(city: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${city}?format=j1`);
5}

rssNotifyExamplemain.tsx1 match

@stevekrouse•Updated 1 year ago
4import RssParser from "npm:rss-parser";
5
6export async function rssNotify() {
7 const lastRunAt = await blob.getJSON(getLegacyImportUrl(import.meta.url));
8 console.log(`Last run: ${lastRunAt || "Never"}`);

emeraldGuanmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { email } from "https://esm.town/v/std/email";
3
4export async function testEmail2(e: {
5 from: string;
6 to: string[];

kyselyVtTypesmain.tsx2 matches

@pomdtr•Updated 1 year ago
25 tables: string[];
26};
27function parseOptions(params: URLSearchParams): GenerateOptions {
28 const camelCase = params.has("camelCase") ? params.get("camelCase") === "true" : undefined;
29 const excludePattern = params.get("excludePattern") ?? undefined;
43 };
44}
45export default async function(req: Request): Promise<Response> {
46 const url = new URL(req.url);
47 if (url.pathname !== "/") return new Response(null, { status: 404 });
tuna

tuna9 file matches

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