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=2425&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 26300 results for "function"(3262ms)

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}

umdImportmain.tsx2 matches

@easrng•Updated 1 year ago
1export async function umdImport(url: string | URL, globals = {}) {
2 const res = await fetch(url);
3 if (!res.ok) throw new Error(await res.text());
16 },
17 });
18 new Function("module", "exports", "global", ...Object.keys(globals), code)(
19 module,
20 module.exports,

bookmarkletPostEvalmain.tsx1 match

@vladimyr•Updated 1 year ago
1function run() {
2 window.location = new URL(`/${document.URL}`, "https://vladimyr-posteval.web.val.run/");
3}

bookmarkletsmain.tsx1 match

@vladimyr•Updated 1 year ago
8const app = new Hono();
9
10async function bookmarkletUrl(author: string, name: string) {
11 const { code } = await api(`/v1/alias/${author}/${name}`);
12 const { code: minifedCode } = await minify(`(${code})();`);

bookmarkletEsmTownmain.tsx1 match

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

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

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.