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/?q=function&page=1409&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 18515 results for "function"(1723ms)

vtu_TestSupportmain.tsx19 matches

@rozekUpdated 7 months ago
6const SkipIndicator = '⏭️ [SKIP]: '
7
8let beforeEachFns:Function[] = []
9let afterEachFns:Function[] = []
10let beforeAllFns:Function[] = []
11let afterAllFns:Function[] = []
12
13/**** describe ****/
14
15export async function describe (
16 CollectionName:string, Collection:Function
17):Promise<void> {
18 const outerBeforeEachFns = beforeEachFns; beforeEachFns = []
41/**** xdescribe ****/
42
43export async function xdescribe (
44 CollectionName:string, Collection:Function
45):Promise<void> {
46 console.log(SkipIndicator + CollectionName)
49/**** it ****/
50
51export async function it (
52 SpecName:string, Spec:Function, Timeout:number = 2000
53) {
54 try {
73/**** xit ****/
74
75export function xit (
76 SpecName:string, Spec:Function, Timeout:number = 2000
77) {
78 console.log(SkipIndicator + SpecName)
81/**** fail ****/
82
83export function fail (Message:string):void {
84 throw new Error(Message)
85}
87/**** before/afterAll/Each ****/
88
89export function beforeAll (Handler:Function):void { beforeAllFns.push(Handler) }
90export function afterAll (Handler:Function):void { afterAllFns.push(Handler) }
91export function beforeEach(Handler:Function):void { beforeEachFns.push(Handler) }
92export function afterEach (Handler:Function):void { afterEachFns.push(Handler) }
93
94/**** runWithTimeout ****/
95
96async function runWithTimeout(
97 Handler:Function, Timeout:number
98):Promise<void> {
99 return Promise.race([

sqliteExplorerAppREADME.md1 match

@robertbrookUpdated 7 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

vtu_generateJWTKeyPairmain.tsx1 match

@rozekUpdated 7 months ago
2import crypto from "node:crypto"
3
4export default async function vtu_generateJWTKeyPair ():Promise<void> {
5 const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
6 namedCurve:'P-384',

vtu_JWTisValidmain.tsx1 match

@rozekUpdated 7 months ago
8import { blob } from "https://esm.town/v/std/blob"
9
10export default async function JWTisValid (JWT:string):Promise<boolean> {
11 expectNonEmptyString('JWT',JWT)
12

vtu_JWTformain.tsx1 match

@rozekUpdated 7 months ago
8import { blob } from "https://esm.town/v/std/blob"
9
10export default async function JWTfor (
11 User:string, Roles:string, Expiration:number = 3600
12) {

vtu_PBKDF2HashMatchesmain.tsx1 match

@rozekUpdated 7 months ago
6const HashPattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?:\d+:(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
7
8export default async function PBKDF2HashMatches (
9 PBKDF2Hash:string, Password:string
10):Promise<boolean> {

vtu_PBKDF2Hashmain.tsx1 match

@rozekUpdated 7 months ago
5} from 'npm:javascript-interface-library'
6
7export default async function PBKDF2Hash (
8 Password:string, Salt?:string, Iterations:number=10000
9):Promise<string> {

spiroplotmain.tsx8 matches

@efoleyUpdated 7 months ago
7const numPointsPerCircle = 200; // Set number of points per circle
8
9function gcd(a: number, b: number): number {
10 return b === 0 ? a : gcd(b, a % b);
11}
12
13function lcm(a: number, b: number): number {
14 return (a * b) / gcd(a, b);
15}
16
17function App() {
18 const chartRef = useRef(null);
19 const chartInstanceRef = useRef(null);
130}
131
132function complexExp(t) {
133 return { re: Math.cos(t), im: Math.sin(t) };
134}
135
136function complexMult(a, b) {
137 if (typeof b === "number") {
138 return { re: a.re * b, im: a.im * b };
144}
145
146function complexAdd(a, b) {
147 return { re: a.re + b.re, im: a.im + b.im };
148}
149
150function client() {
151 createRoot(document.getElementById("root")).render(<App />);
152}
153if (typeof document !== "undefined") { client(); }
154
155export default async function server(request: Request): Promise<Response> {
156 return new Response(
157 `

webcamEffectsmain.tsx5 matches

@kianUpdated 7 months ago
10import { createRoot } from "https://esm.sh/react-dom/client";
11
12function App() {
13 const videoRef = useRef<HTMLVideoElement>(null);
14 const canvasRef = useRef<HTMLCanvasElement>(null);
25
26 useEffect(() => {
27 async function setupWebcam() {
28 try {
29 audioContextRef.current = new (window.AudioContext || (window as any).webkitAudioContext)();
30
31 // Function to create and play continuous audio effect
32 const playContinuousAudio = (baseFreq: number, modFreq: number) => {
33 if (!audioContextRef.current) return;
306
307// client-side only code
308function client() {
309 createRoot(document.getElementById("root")!).render(<App />);
310}
312
313// server-side only code
314export default async function server(request: Request): Promise<Response> {
315 return new Response(
316 `

shySapphireLeopardmain.tsx3 matches

@muhammad_owais_warsiUpdated 7 months ago
5import { createRoot } from "https://esm.sh/react-dom/client";
6
7function App() {
8 const links = [
9 { name: "Twitter", url: "https://x.com/MO_warsi786" },
30}
31
32function client() {
33 createRoot(document.getElementById("root")).render(<App />);
34}
36if (typeof document !== "undefined") { client(); }
37
38async function server(request: Request): Promise<Response> {
39 return new Response(
40 `

getFileEmail4 file matches

@shouserUpdated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 2 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.