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/$%7Bart_info.art.src%7D?q=function&page=2329&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 25191 results for "function"(1392ms)

syntheticLootmain.tsx3 matches

@jamiedubs•Updated 1 year ago
11// const svg = `<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">Grave Wand</text><text x="10" y="40" class="base">Ornate Chestplate</text><text x="10" y="60" class="base">Dragon's Crown of Protection</text><text x="10" y="80" class="base">War Belt</text><text x="10" y="100" class="base">"Fate Sun" Divine Slippers of Power</text><text x="10" y="120" class="base">Silk Gloves</text><text x="10" y="140" class="base">Necklace</text><text x="10" y="160" class="base">Bronze Ring</text></svg>`;
12
13async function fetchAndParseSvgFromJson(account: string) {
14 try {
15 const response = await fetch(`${url}/${account}`);
42};
43
44function parseElementsFromSvg(svgString: string): SvgTextElement[] {
45 const parser = new DOMParser();
46 // deno-dom only supports HTML
60}
61
62export default async function(req: Request): Promise<Response> {
63 const url = new URL(req.url);
64 console.log(url.searchParams);

quote_of_the_daymain.tsx1 match

@robik•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export async function quote_of_the_day() {
5 const [qod] = await fetchJSON(
6 "https://zenquotes.io/api/today",

classless_cssmain.tsx2 matches

@stevekrouse•Updated 1 year ago
4delete frameworks[""];
5
6function absolutePath(url: string) {
7 if (url.startsWith("http")) return url;
8 else return `https://classless-css-demo.deno.dev` + url;
13export const randomStyle = `<link rel="stylesheet" href="${randomURL}">`;
14
15export default function(req: Response) {
16 const url = new URL(req.url);
17

classless_cssREADME.md1 match

@stevekrouse•Updated 1 year ago
10import { randomStyle } from "https://esm.town/v/stevekrouse/classless_css";
11
12export default async function(req: Request): Promise<Response> {
13 return new Response(`<h1>Welcome to Val Town!</h1>${randomStyle}`, {
14 headers: {

untitled_magentaQuailmain.tsx1 match

@shiann3•Updated 1 year ago
7
8// Fetches a random joke.
9async function fetchRandomJoke() {
10 const response = await fetch(
11 "https://official-joke-api.appspot.com/random_joke",

formattingEmailContentmain.tsx1 match

@willthereader•Updated 1 year ago
2import { parentCommentChecker } from "https://esm.town/v/willthereader/parentCommentChecker";
3import { replaceHTMLWithTextFormatting } from "https://esm.town/v/willthereader/replaceHtmlWithTextFormatting";
4export function formattingEmailContent(commentsArray) {
5 // console.log(commentsArray);
6 let commentsString = "";

quinemain.tsx1 match

@maxm•Updated 1 year ago
1export function quine() {
2 return `${quine}`;
3}

getMemain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function getMe(): Promise<{ username: string; id: string; profileImageUrl; bio: string }> {
4 return fetchJSON("https://api.val.town/v1/me", {
5 headers: {

codeOnValTownREADME.md1 match

@andreterron•Updated 1 year ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

myApimain.tsx1 match

@greatcode•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

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.