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/$%7Burl%7D?q=function&page=2067&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 22581 results for "function"(2908ms)

open_in_valtownmain.tsx1 match

@stevekrouse•Updated 1 year ago
5 * @param handler Fetch handler
6 */
7export default function openInValTown(
8 handler: (req: Request) => Promise<Response>,
9): (req: Request) => Promise<Response> {

maxValSizemain.tsx1 match

@stevekrouse•Updated 1 year ago
1export const MAX_VAL_SIZE = 10_000_000
2
3export function maxSizeOrError(data) {
4 const string = JSON.stringify(data)
5 if (string.length > MAX_VAL_SIZE) {

resizeScriptmain.tsx5 matches

@nbbaier•Updated 1 year ago
1console.log("resizing script loaded!");
2if (typeof Deno === "undefined") {
3 const resizable = function(resizer) {
4 const direction = resizer.getAttribute("data-direction") || "horizontal";
5 const prevSibling = resizer.previousElementSibling;
11 let prevSiblingWidth = 0;
12
13 const mouseDownHandler = function(e) {
14 const parent = e.currentTarget.parentElement;
15 const direction = parent.getAttribute("data-direction") || "horizontal";
27 };
28
29 const mouseMoveHandler = function(e) {
30 const dx = e.clientX - x;
31 const dy = e.clientY - y;
56 };
57
58 const mouseUpHandler = function() {
59 resizer.style.removeProperty("cursor");
60 document.body.style.removeProperty("cursor");
75 };
76
77 document.querySelectorAll(".resizer").forEach(function(ele) {
78 resizable(ele);
79 });

flydotioRSSmain.tsx1 match

@mstubbs•Updated 1 year ago
2import { Feed, FeedOptions, Item as FeedItem } from "npm:feed";
3
4export async function flydotioRSS(req: Request): Promise<Response> {
5 const response = await fetch("https://fly.io/blog/");
6 const body = await response.text();

muxWebhookHandlermain.tsx1 match

@mmcc•Updated 1 year ago
24const prompts = classes.map(c => `${storyboardPreface} ${c[1]}`);
25
26export default async function(req: Request): Promise<Response> {
27 if (req.method === "GET") {
28 return Response.json({ nada: true });

sendEmailREADME.md1 match

@thu•Updated 1 year ago
1Migrated from folder: functions/sendEmail

retroVisitCountermain.tsx1 match

@maxm•Updated 1 year ago
5)`);
6
7async function getCurrentCount(): Promise<number> {
8 let counter = await sqlite.execute(`select counter from counter where name = 'retro'`);
9 if (counter.rows.length === 0) {

indigoOwlmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import delay from "npm:delay";
3
4export default monitored(async function(interval: Interval) {
5 console.log(`Last run at ${interval.lastRunAt}`);
6 console.log("Starting 2s simulated job...");

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

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.