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=2418&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 28333 results for "function"(2305ms)

openapi_playgroundmain.tsx1 match

@stainless_em•Updated 8 months ago
237 return c.html(<App code={code} />);
238});
239function template(code: string) {
240 return `import { makeServer } from "https://esm.town/v/stainless_em/openapiPlaygroundServer"\nexport default makeServer(${
241 JSON.stringify(YAML.parse(code))

runmain.tsx2 matches

@websandbox•Updated 8 months ago
15 body: string;
16};
17export async function handle(req: Request) {
18 const id = new URL(req.url).hostname.match(/^websandbox-(play_[^\.]+)/)[1];
19 const code = await (await blob.get(id)).text();
49 }
50}
51export async function inner(serializedRequest: SerializedRequest, code: string): Promise<SerializedResponse> {
52 try {
53 const req = new Request(serializedRequest.url, {

createAPImain.tsx1 match

@websandbox•Updated 8 months ago
7 "access-control-allow-headers": "*",
8};
9export default async function(req: Request): Promise<Response> {
10 try {
11 if (req.method === "OPTIONS") {

pasetomain.tsx1 match

@maxm•Updated 8 months ago
6// console.log(await V4.generateKey("public", { format: "keyobject" }));
7
8function uuidToHex(uuid: string): string {
9 // Remove hyphens from the UUID
10 const cleanUuid = uuid.replace(/-/g, "");

oldDebugging_Guidemain.tsx1 match

@willthereader•Updated 8 months ago
48
49
50Using your intuition as a starting point. Did you change a function recently? Are there any likely culprits?
51
52

WobbleShapesmain.tsx4 matches

@yawnxyz•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function PotteryPlate({ radius, color, wobbliness, wobbleFrequency, wobbleIrregularity, rotation }) {
6 const points = [];
7 const centerX = 250;
35}
36
37function App() {
38 const [plate, setPlate] = useState(null);
39 const [svgString, setSvgString] = useState('');
139}
140
141function client() {
142 createRoot(document.getElementById("root")).render(<App />);
143}
144if (typeof document !== "undefined") { client(); }
145
146async function server(request: Request): Promise<Response> {
147 return new Response(`
148 <!DOCTYPE html>

primeTurquoiseTernmain.tsx1 match

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

dateme_browsemain.tsx4 matches

@stevekrouse•Updated 8 months ago
5import { zip } from "npm:lodash-es";
6
7function absoluteURL(url) {
8 if (url.startsWith("http://") || url.startsWith("https://"))
9 return url;
25let linkClass = "text-sky-600 hover:text-sky-500";
26
27function httpsIfy(url: string) {
28 if (!url.startsWith("http://") && !url.startsWith("https://")) {
29 return `https://${url}`;
32}
33
34function renderCell(header, row) {
35 let data = row[header];
36 if (header === "Name") {
46}
47
48export default async function Browse(c) {
49 const url = new URL(c.req.url);
50 const search = {

passwordGenmain.tsx4 matches

@prashamtrivedi•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [darkMode, setDarkMode] = useState(false);
7 const [input, setInput] = useState("");
200}
201
202function client() {
203 createRoot(document.getElementById("root")).render(<App />);
204}
208}
209
210async function server(request: Request): Promise<Response> {
211 if (request.method === "POST" && new URL(request.url).pathname === "/generate") {
212 const { input, policy } = await request.json();
270}
271
272function generatePasswords(input: string, policy: any): string[] {
273 const substitutions = [
274 { original: "i", replacements: ["1", "!"] },

dateme_browsemain.tsx4 matches

@lejlot•Updated 8 months ago
5import { zip } from "npm:lodash-es";
6
7function absoluteURL(url) {
8 if (url.startsWith("http://") || url.startsWith("https://"))
9 return url;
25let linkClass = "text-sky-600 hover:text-sky-500";
26
27function httpsIfy(url: string) {
28 if (!url.startsWith("http://") && !url.startsWith("https://")) {
29 return `https://${url}`;
32}
33
34function renderCell(header, row) {
35 let data = row[header];
36 if (header === "Name") {
46}
47
48export default async function Browse(c) {
49 const url = new URL(c.req.url);
50 const search = {

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.