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=2456&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 28709 results for "function"(3274ms)

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 = {

extractSchemaOrgJsonmain.tsx1 match

@aeaton•Updated 8 months ago
1import { DOMParser } from "https://esm.sh/linkedom";
2
3export default async function server(request: Request): Promise<Response> {
4 if (request.method !== "GET") {
5 return new Response("Method not allowed", { status: 405 });

p5README.md4 matches

@eyeseethru•Updated 8 months ago
10```
11
12* Export any "global" p5 functions. These are functions like `setup` and `draw` that p5 will call.
13
14* Set the val type to http and default export the result of `sketch`, passing in `import.meta.url`.
19import type * as p5 from "npm:@types/p5";
20
21export function setup() {
22 createCanvas(400, 400);
23}
24
25export function draw() {
26 if (mouseIsPressed) {
27 fill(0);
37
38## How it works
39The sketch function returns an http handler that sets up a basic page with p5.js added. It then imports your module from the browser and wires up all the exports so p5.js can see them. All the code in your val will run in the browser (except for the default `sketch` export) so you can't call any Deno functions, environment variables, or other server side apis.
40

p5main.tsx3 matches

@eyeseethru•Updated 8 months ago
1export function sketch(module: string): (req: Request) => Response {
2 return function(req: Request): Response {
3 return new Response(
4 `
40}
41
42export default async function(req: Request): Promise<Response> {
43 return new Response(
44 `

add_to_notion_w_aimain.tsx9 matches

@eyeseethru•Updated 8 months ago
35});
36
37function createPrompt(title, description, properties) {
38 let prompt =
39 "You are processing content into a database. Based on the title of the database, its properties, their types and options, and any existing descriptions, infer appropriate values for the fields:\n";
80}
81
82function processProperties(jsonObject) {
83 const properties = jsonObject.properties;
84 const filteredProps = {};
111}
112
113async function get_and_save_notion_db_processed_properties(databaseId)
114{
115 const response = await notion.databases.retrieve({ database_id: databaseId });
122}
123
124async function get_notion_db_info(databaseId) {
125 databaseId = databaseId.replaceAll("-", "");
126 let db_info = null;
137}
138
139async function get_and_save_notion_db_info(databaseId) {
140 databaseId = databaseId.replaceAll("-", "");
141 let db_info = await get_and_save_notion_db_processed_properties(databaseId);
144}
145
146function createZodSchema(filteredProps) {
147 const schemaObject = {};
148
193}
194
195function convertToNotionProperties(responseValues, filteredProps) {
196 const notionProperties = {};
197
268}
269
270async function process_text(dbid, text) {
271 const db_info = await get_notion_db_info(dbid);
272 const processed_message = await client.chat.completions.create({
283}
284
285async function addToNotion(databaseId, text) {
286 databaseId = databaseId.replaceAll("-", "");
287 const properties = await process_text(databaseId, text);

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.