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=2706&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 29117 results for "function"(2108ms)

sudokumain.tsx1 match

@saolsen•Updated 1 year ago
10export type Sudoku = z.infer<typeof Sudoku>;
11
12export function print(sudoku: Sudoku) {
13 sudoku = Sudoku.parse(sudoku);
14 for (let row = 0; row < ROWS; row++) {

blogSqliteUniversemain.tsx1 match

@postpostscript•Updated 1 year ago
2import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
3
4export default function(req: Request) {
5 const { author, name } = extractValInfo(import.meta.url);
6 const blogEndpoint = getValEndpointFromName(`@${author}/blog`);

sql_searchmain.tsx1 match

@pomdtr•Updated 1 year ago
2import { db } from "https://esm.town/v/sqlite/db?v=9";
3
4export default async function(req: Request) {
5 const url = new URL(req.url);
6 if (!url.searchParams.has("query")) {

authIdBasemain.tsx7 matches

@postpostscript•Updated 1 year ago
17const COOKIE_NAME = "AUTH_ID_TOKEN";
18
19export function authId(url: string) {
20 const SCOPES = {
21 id: "provides proof that you are you",
25 const NAME = "@" + slug;
26
27 async function emailSignInLink(clientToken: string) {
28 const minutes = 15;
29 const token = await generate({
45 }
46
47 async function handler(req: Request) {
48 const { searchParams: qs } = new URL(req.url);
49
280}
281
282export function getAuthCookie(req: Request) {
283 return getCookies(req.headers)[COOKIE_NAME];
284}
285
286export function setAuthCookie(res: Response, token: string | undefined) {
287 if (token === undefined) {
288 setCookie(res.headers, {
306}
307
308export function getScopeUrl(scope: string) {
309 return getValUrlFromName(scope.split("/").slice(0, 2).join("/"), "val.town");
310}
311
312export function getScopeLink(scope: string) {
313 const name = scope.split("/").slice(0, 2).join("/");
314 return html`

aqimain.tsx1 match

@ProgStudio•Updated 1 year ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "mataram ntb indonesia"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

bookmarkletMdViewermain.tsx1 match

@vladimyr•Updated 1 year ago
1function run() {
2 const target = new URL(document.URL);
3 target.hostname = "vladimyr-mdviewer.web.val.run";

readmemain.tsx3 matches

@pomdtr•Updated 1 year ago
2import { gfm } from "https://esm.town/v/pomdtr/gfm";
3
4export async function readmeToHtmlResponse(author: string, name: string) {
5 return new Response(await readmeToHtml(author, name), {
6 headers: {
10}
11
12export async function readmeToHtml(author: string, name: string) {
13 const markdown = await readme(author, name);
14 return gfm(markdown);
15}
16
17export async function readme(author: string, name: string) {
18 const { readme } = await api(`/v1/alias/${author}/${name}`);
19 return readme;

sqliteBackupIntervalmain.tsx2 matches

@postpostscript•Updated 1 year ago
2import { email } from "https://esm.town/v/std/email?v=11";
3
4export async function sqliteBackupWithEmail() {
5 const { name, content } = await sqliteBackup();
6 return email({
17}
18
19export default function() {
20 return sqliteBackupWithEmail();
21}

weatherGPTmain.tsx1 match

@liaolile•Updated 1 year ago
28console.log(text);
29
30export async function weatherGPT() {
31 const result = await fetch(`https://hello.liaolile.com/test/weather`, {
32 method: "POST",

jadeCodmain.tsx1 match

@u•Updated 1 year ago
1export async function handlePlexWebhook(req: Request) {
2 console.log(await req.text());
3}
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.