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%22Image%20title%22?q=function&page=1838&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 20424 results for "function"(1753ms)

dubShortenURLmain.tsx1 match

@vladimyr•Updated 1 year ago
1import ky from "npm:ky";
2
3export async function shortenURL(url: URL | string) {
4 const json = {
5 domain: "dub.sh",

sqlitePublicmain.tsx2 matches

@vladimyr•Updated 1 year ago
37};
38
39async function execute(statement: InStatement): Promise<ResultSet> {
40 return ky.post("execute", {
41 json: { statement },
44}
45
46async function batch(statements: InStatement[]): Promise<ResultSet[]> {
47 return ky.post("batch", {
48 json: { statements },

sqlitePublicmain.tsx3 matches

@pps•Updated 1 year ago
10const dumped = {};
11
12async function database() {
13 const dump = await sqliteDump(dumped);
14 const sqlite = createSqlite();
22};
23
24async function execute(statement: InStatement): Promise<ResultSet> {
25 const res = await fetch(`${ENDPOINT}/execute`, {
26 method: "POST",
33}
34
35async function batch(statements: InStatement[]): Promise<ResultSet[]> {
36 const res = await fetch(`${ENDPOINT}/batch`, {
37 method: "POST",

valTownLogo_test2main.tsx1 match

@vladimyr•Updated 1 year ago
6} from "https://esm.town/v/postpostscript/valTownLogo";
7
8export default async function(req: Request): Promise<Response> {
9 const html = `
10 <html>

gfmmain.tsx2 matches

@vladimyr•Updated 1 year ago
1export async function html(markdown: string) {
2 const [
3 { micromark },
15}
16
17export async function gfm(
18 markdown: string,
19 options?: {

aspBadgemain.tsx3 matches

@vladimyr•Updated 1 year ago
24const BADGE_COLOR = "6855c3";
25
26export default async function(req: Request): Promise<Response> {
27 const reqURL = new URL(req.url);
28 if (reqURL.pathname === "/") {
54}
55
56async function getBadgeConfig(aspeUri: string, debug = false): Promise<BadgeConfig> {
57 const config: BadgeConfig = {
58 label: BADGE_LABEL,
77}
78
79async function processAspeUri(aspeUri: string) {
80 let aspeURI: AspeURI | LegacyAspeURI = parseAspeURI(aspeUri);
81 if (!aspeURI) {

appendFragmentmain.tsx1 match

@vladimyr•Updated 1 year ago
1// SPDX-License-Identifier: 0BSD
2
3export function appendFragment(fragment: string, html: string) {
4 if (!fragment) return html;
5 let offset = Math.min(

dailyPelotonEmailRemindermain.tsx1 match

@tarngerine•Updated 1 year ago
4import { isSameDay } from "npm:date-fns";
5
6export default async function checkTodayWorkout() {
7 const data = await fetchPelotonWorkouts(
8 "3f5bf759bb65494d8b35d26ec72b7340",

commentsmain.tsx2 matches

@parkerdavis•Updated 1 year ago
5const KEY = import.meta.url.split("?")[0];
6
7export async function addComment(str) {
8 const comments = await blob.getJSON(KEY) as Array<string> ?? [];
9 comments.push(str);
11 await email({ text: "New Comment Alert!: " + str });
12}
13export async function getComments() {
14 return await blob.getJSON(KEY) as Array<string> ?? [];
15}

brownCoralmain.tsx1 match

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

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.