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/image-url.jpg%20%22Optional%20title%22?q=function&page=1780&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 19476 results for "function"(2027ms)

htmlUtilsmain.tsx1 match

@xkonti•Updated 1 year ago
2 * Wraps `content` between `open` and `close` content. If the content is a list, it puts each in a new line.
3 */
4export function wrap(open: string, content: string | string[], close: string): string {
5 let contentString: string = Array.isArray(content)
6 ? content.join("\n")

checkHfsmain.tsx1 match

@rejetto•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2export async function checkHfs(url: string) {
3 const res = await (await fetch(url)).text();
4 return res.includes("HFS");

dailyDadJokemain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({

moviesmain.tsx1 match

@ion•Updated 1 year ago
1export default async function untitled_jadeCarp(req: Request): Promise<Response> {
2 return Response.json(
3 [

untitled_aquaQuailmain.tsx4 matches

@liflovs•Updated 1 year ago
9
10// ------------
11// Functions
12// ------------
13
14async function execute(statement: InStatement): Promise<ResultSet> {
15 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
16 method: "POST",
26}
27
28async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
29 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
30 method: "POST",
40}
41
42function createResError(body: string) {
43 try {
44 const e = zLibsqlError.parse(JSON.parse(body));

aoc_2023_11_practicalmain.tsx1 match

@robsimmons•Updated 1 year ago
54`;
55
56function bigabs(x) {
57 return x < 0 ? -x : x;
58}

valTownBlogRSSmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { valTownBlogJSON } from "https://esm.town/v/stevekrouse/valTownBlogJSON";
3
4export async function valTownBlogRSS() {
5 return Response.redirect("https://blog.val.town/rss.xml", 301);
6}

pdfPreviewPluginInstalledmain.tsx1 match

@fahimfoysal•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email";
2
3export function pdfPreviewPluginInstalled(siteURL, checker) {
4 // Define the approved sites array
5 let approvedSites = ["2917bc58d0dcfe0b3febd40f2c7eebf2"];

echoRefmain.tsx1 match

@pomdtr•Updated 1 year ago
1import { callerRef, selfRef } from "https://esm.town/v/pomdtr/refs";
2
3export function hello() {
4 return `Hi ${callerRef().slug}, I'm ${selfRef().slug}`;
5}

refsmain.tsx2 matches

@pomdtr•Updated 1 year ago
2import StackTrace from "npm:stacktrace-js";
3
4export function selfRef() {
5 const stacktrace = StackTrace.getSync();
6 const moduleURL = stacktrace[1]?.fileName;
8}
9
10export function callerRef() {
11 const stacktrace = StackTrace.getSync();
12 const moduleURL = stacktrace[2]?.fileName;

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks 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.