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=1596&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 19470 results for "function"(1924ms)

p5README.md4 matches

@moe•Updated 9 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
41

glideREADME.md3 matches

@dvdsgl•Updated 9 months ago
1# Glide API 2.0
2
3`Effects` and utility functions for working with Glide API 2.0.
4
5## Authentication
16await Glide.importTable({
17 table: "abc123-def456-ghi789",
18 getRows: async function*() {
19 // yield Row[] to add them to the stash
20 yield [{ Name: "David" }];
30await Glide.importTable({
31 table: "abc123-def456-ghi789",
32 getRows: async function*() {
33 const octokit = new Octokit({ auth: "..." });
34 for await (

aquaAntmain.tsx6 matches

@tempguy•Updated 9 months ago
76}
77
78// Extract function to process encrypted data
79async function extract(url) {
80 try {
81 const response = await fetch(url, {
101 const _0x3cbaf6 = "episode";
102
103 function key() {
104 return $("body[class^='container-']").attr("class").split("-").pop();
105 }
106
107 function iv() {
108 return $("div[class*='container-']").attr("class").split("-").pop();
109 }
110
111 function key2() {
112 return $("div[class*='videocontent-']").attr("class").split("-").pop();
113 }
152 return _0x3b405f;
153 } catch (error) {
154 console.error("Error in extract function:", error);
155 }
156}

ReactStream_migratedREADME.md4 matches

@jxnblk•Updated 9 months ago
7import { render, React } from "https://esm.town/v/jxnblk/ReactStream";
8
9function App() {
10 const [count, setCount] = React.useState(0);
11 return (
62```tsx
63// example middleware
64async function api (req: Request, res: Response, next): Promise<Response> {
65 if (req.pathname !== "/api") return next();
66 if (req.method === "POST") {
78```tsx
79// example middleware
80async function getInitialProps (req: Request, res: Response, next) {
81 // fetch data or do async work to pass as props to the component
82 req.data = {
95import { render } from "https://esm.town/v/jxnblk/ReactStream";
96
97function App () {
98 return (
99 <html>

hono_countermain.tsx1 match

@iamseeley•Updated 9 months ago
3import { useState } from "https://esm.sh/hono/jsx/dom";
4
5export default function Counter(props: { initialCount?: number }) {
6 const [count, setCount] = useState(props.initialCount || 0);
7 return (

copperScorpionmain.tsx1 match

@tempguy•Updated 9 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2export default async function(request: Request) {
3 const url = new URL(request.url);
4 const h = url.searchParams.get("tdestination");

liteutilsmain.tsx1 match

@tempguy•Updated 9 months ago
9}
10
11export async function convertHTMLToJSON(html: string): Promise<ServerInfo[]> {
12 const parser = new DOMParser();
13 const doc = parser.parseFromString(html, "text/html");

citationmain.tsx1 match

@yawnxyz•Updated 9 months ago
23
24
25export async function getCitation(citationId: string, type = 'bibtex', opts) {
26 citationId = extractDOI(citationId);
27 console.log('citationId', citationId)

silverSwallowmain.tsx1 match

@tempguy•Updated 9 months ago
1import { blob } from "https://esm.town/v/std/blob?v=12";
2export default async function(interval: Interval) {
3 await fetch("https://tempguy-scarletsole.web.val.run/refresh");
4 const date = new Date();

airportCodeMapRedirectormain.tsx1 match

@dthyresson•Updated 9 months ago
1export default async function(req: Request): Promise<Response> {
2 const query = new URL(req.url).searchParams;
3 const iata = query.get("iata") || query.get("q");

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks 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.