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/$%7Bsuccess?q=function&page=63&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 19855 results for "function"(1929ms)

Afolabis2server.tsx2 matches

@vawogbemi•Updated 2 days ago
1import { parseProject } from "https://esm.town/v/std/utils@71-main/index.ts";
2
3function getContentType(filepath: string): string {
4 // If no extension or empty path, default to text/html
5 if (filepath === "" || filepath === "/" || !filepath.includes(".")) {
27
28const projectVal = parseProject(import.meta.url);
29export default async function(req: Request): Promise<Response> {
30 const url = new URL(req.url);
31 const path = `/${projectVal.username}/${projectVal.name}@${projectVal.version}${url.pathname}`;

Afolabis2README.md1 match

@vawogbemi•Updated 2 days ago
11```ts
12const projectVal = parseProject(import.meta.url);
13export default async function(req: Request): Promise<Response> {
14 const url = new URL(req.url);
15 const path = `/${projectVal.username}/${projectVal.name}@${projectVal.version}${url.pathname}`;

denoViteserver.tsx2 matches

@vawogbemi•Updated 2 days ago
1import { parseProject } from "https://esm.town/v/std/utils@71-main/index.ts";
2
3function getContentType(filepath: string): string {
4 // If no extension or empty path, default to text/html
5 if (filepath === "" || filepath === "/" || !filepath.includes(".")) {
27
28const projectVal = parseProject(import.meta.url);
29export default async function(req: Request): Promise<Response> {
30 const url = new URL(req.url);
31 const path = `/${projectVal.username}/${projectVal.name}@${projectVal.version}${url.pathname}`;

denoViteREADME.md1 match

@vawogbemi•Updated 2 days ago
11```ts
12const projectVal = parseProject(import.meta.url);
13export default async function(req: Request): Promise<Response> {
14 const url = new URL(req.url);
15 const path = `/${projectVal.username}/${projectVal.name}@${projectVal.version}${url.pathname}`;

testPondiversemain1 match

@argmn•Updated 2 days ago
7import user from "./user";
8
9export default async function(req: Request): Promise<Response> {
10 let url = new URL(req.url);
11 const path = url.pathname.toLowerCase();

testPondiverseaddCreation1 match

@argmn•Updated 2 days ago
4import { TABLE_NAME } from "./updateTable";
5
6export default async function(req: Request): Promise<Response> {
7 // body contains:
8 // - title (string)

gordwameSVGComponent.tsx1 match

@alexwein•Updated 2 days ago
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5export function SVGComponent({
6 width,
7 height,

gordwamequeries.ts5 matches

@alexwein•Updated 2 days ago
2
3// gets a random 8 or 10 letter word and uses the letters to generate the board
4export async function newBoard(seed = "seed", length = 12) {
5 try {
6 const query = `
56 return output;
57 } catch (error) {
58 console.error("Error in newBoard function:", error);
59
60 // Return a default board in case of error
74}
75
76function isOnBoard(word, board) {
77 if (!word || !board || word.length !== board.length) return false;
78
100}
101
102function wordbankQuery(wordbank: string, min: number = 3, max: number = 16) {
103 // iteratively create a replace(replace(...)) template for SQLite query
104 // the idea is to take every word in the list and replace all of the letters in the wordbank with an empty string
122}
123
124export async function solutions(
125 board: { position: number; inner: string; outer: string; flipped: boolean }[],
126) {

meowindex.tsx15 matches

@probablycorey•Updated 2 days ago
1/** @jsxImportSource https://esm.sh/preact */
2import { JSX, FunctionalComponent } from "npm:preact"
3import { render } from "npm:preact-render-to-string"
4
5
6export default function handler(request: Request) {
7 return new Response(render(<html>
8 <head>
48}
49
50const Stack: FunctionalComponent<StackProps> = ({
51 direction,
52 gap,
91}
92
93export const VStack: FunctionalComponent<BoxProps> = (props) => (
94 <Stack direction="column" {...props} />
95)
96
97export const HStack: FunctionalComponent<BoxProps> = (props) => (
98 <Stack direction="row" {...props} />
99)
107
108
109const Image: FunctionalComponent<ImageProps> = (props) => {
110 const { src, w, h, fit, children, style, className, ...rest } = props
111 const altText = children?.toString() || ''
135}
136
137const Header: FunctionalComponent<HeaderProps> = (props) => {
138 const { size = 1, p, m, style, className, children, ...rest } = props
139 const Tag = (`h${size}` as keyof JSX.IntrinsicElements) as any
157
158
159const Text: FunctionalComponent<TextProps> = (props) => {
160 const { alignX, p, m, style, className, children, ...rest } = props
161 const computedStyle = {
178}
179
180const GenericButton: FunctionalComponent<ButtonProps> = (props) => {
181 const { variant = 'primary', p, m, style, className, children, ...rest } = props
182 const computedStyle = {
198}
199
200const Button = function (props: ButtonProps) {
201 return <GenericButton {...props} />
202}
203Button.Outline = function (props: ButtonProps) {
204 return <GenericButton variant="outline" {...props} />
205}
206Button.Primary = function (props: ButtonProps) {
207 return <GenericButton variant="primary" {...props} />
208}
209Button.Secondary = function (props: ButtonProps) {
210 return <GenericButton variant="secondary" {...props} />
211}
217}
218
219const Link: FunctionalComponent<LinkProps> = (props) => {
220 const { p, m, style, className, children, ...rest } = props
221 const computedStyle = {
232}
233
234function App() {
235 return (
236<VStack gap="32" alignX="center" alignY="center" p="16" h="screen">

stevensDemosetupDbTables.ts1 match

@kuanche•Updated 2 days ago
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
5 try {
6 // Import SQLite module

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.