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/$%7Burl%7D?q=function&page=2627&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 28734 results for "function"(7866ms)

myspaceCSSmain.tsx1 match

@jdan•Updated 1 year ago
1export function myspaceCSS() {
2 return `
3 .verdana12 {

mockingSpongebobmain.tsx2 matches

@carl•Updated 1 year ago
1/**
2 * Function that randomly capitalizes or lowercases each character in a string.
3 * Inspired by the mocking Spongebob meme: https://knowyourmeme.com/memes/mocking-spongebob
4 *
8 * @param text The text to be transformed
9 */
10export default function mockingSpongebob(text: string) {
11 let result = "";
12 for (let i = 0; i < text.length; i++) {

redSpoonbillmain.tsx1 match

@Joelsrubin•Updated 1 year ago
1export async function getTopTenBattingAverage() {
2 const data = await fetch(
3 "http://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/seasons/2024/types/2/leaders?lang=en&region=us",

UserLinksmain.tsx1 match

@iamseeley•Updated 1 year ago
4
5
6export default function UserLinks({ username, links }) {
7
8

EditLinkModalmain.tsx1 match

@iamseeley•Updated 1 year ago
3import { jsx, Fragment } from 'https://deno.land/x/hono/middleware.ts'
4
5export default function EditLinkModal({ username, linkId, label, url }) {
6
7 return (

ctanPackageNamesmain.tsx1 match

@aleaf•Updated 1 year ago
1export default async function(req: Request): Promise<Response> {
2 const response = await fetch("https://ctan.org/json/2.0/packages");
3 const packages = await response.json();

googleFeelingLuckymain.tsx6 matches

@vladimyr•Updated 1 year ago
5 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
6
7export default async function(req: Request): Promise<Response> {
8 const { searchParams } = new URL(req.url);
9 const query = searchParams.get("q");
17}
18
19export function search(query: string, userAgent = DEFAULT_USER_AGENT) {
20 const searchUrl = createSearchUrl(query);
21 return getRedirectUrl(searchUrl, userAgent);
22}
23
24export function createSearchUrl(query: string, buttonName = "") {
25 const searchURL = new URL("https://www.google.com/search");
26 searchURL.searchParams.set("q", query);
29}
30
31export async function getRedirectUrl(searchUrl: string | URL, userAgent = DEFAULT_USER_AGENT) {
32 const resp = await ky.get(searchUrl, { headers: { "user-agent": userAgent } });
33 const { searchParams } = new URL(resp.url);
36}
37
38export async function signSearchUrl(searchUrl: string | URL) {
39 const signedURL = new URL(searchUrl);
40 const params = await getSearchParams();
43}
44
45export async function getSearchParams(userAgent = DEFAULT_USER_AGENT) {
46 await initParser();
47 const html = await ky.get("https://www.google.com", { headers: { "user-agent": userAgent } }).text();

fetchWorkermain.tsx2 matches

@postpostscript•Updated 1 year ago
6workerURL.searchParams.set("worker", "1");
7
8export async function fetchWorker(opts: {
9 url: string;
10 handler?: string;
83}
84
85export function setupWorker() {
86 let handler: (req: Request) => Promise<Response>;
87

userAgentsmain.tsx1 match

@alexbowe•Updated 1 year ago
102];
103
104export function getRandomUserAgent() {
105 const i = Math.floor(Math.random() * USER_AGENTS.length);
106 return USER_AGENTS[i];

mdConvertmain.tsx1 match

@stevekrouse•Updated 1 year ago
9});
10
11export default async function handler(request: Request) {
12 if (request.method !== "POST") {
13 return html(`

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.