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=1524&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 17289 results for "function"(1807ms)

bookmarkletsREADME.md1 match

@vladimyr•Updated 1 year ago
5## Usage
6
7You val should export an anonymous function, containing the code that will run when the bookmarklet is triggered.
8
9```typescript

denoMediaTypesmain.tsx10 matches

@easrng•Updated 1 year ago
20/// Definition files don't have separate content types and so we have to "guess"
21/// at what they are meant to be.
22function map_typescript_like(
23 path: string,
24 base_type: MediaType,
40 return base_type;
41}
42export function as_ts_extension(type: MediaType): string {
43 return ({
44 [MediaType.JavaScript]: ".js",
69 })[type];
70}
71export function as_content_type(type: MediaType): string | undefined {
72 return ({
73 [MediaType.JavaScript]: ("text/javascript"),
89 })[type];
90}
91export function is_declaration(type: MediaType): type is MediaType.Dts | MediaType.Dcts | MediaType.Dmts {
92 return type === MediaType.Dts || type === MediaType.Dmts || type === MediaType.Dcts;
93}
94export function from_response(response: Response) {
95 return from_url_and_content_type(new URL(response.url), response.headers.get("content-type"));
96}
97export function from_url_and_content_type(
98 url: URL,
99 maybe_content_type?: string,
105 }
106}
107export function from_content_type(
108 url: URL,
109 content_type: string,
155 return MediaType.Unknown;
156}
157export function from_url(url: URL): MediaType {
158 let data_url;
159 if (url.protocol !== "data:") {
165 }
166}
167export function from_path(path: string): MediaType {
168 const [file_stem, file_name, file_ext] = split_path(path);
169 if (!file_ext) {
201 }
202}
203function map_js_like_extension(
204 url: URL,
205 default_: MediaType,

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",

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",