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=2529&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 28846 results for "function"(1876ms)

retiredRedMarlinmain.tsx2 matches

@tempguy•Updated 10 months ago
1import { base } from "https://esm.town/v/tempguy/southcloud";
2
3async function fetchStreamLink() {
4 try {
5 const headers = {
47}
48
49// Call the function
50fetchStreamLink();

southcloudmain.tsx2 matches

@tempguy•Updated 10 months ago
6const dataChart: { variable: string; value: number }[][] = [];
7
8function getValueOf(text: string): number {
9 const pattern = new RegExp(`,${text}=0x([a-zA-Z0-9]+)`, "g");
10 const match = pattern.exec(str);
34 }
35};
36export function base(p) {
37 let key = "";
38 let encryptedText = p;

verifyUserEmailmain.tsx1 match

@pomdtr•Updated 10 months ago
1import { api } from "https://esm.town/v/pomdtr/api";
2
3export async function verifyUserEmail(email: string) {
4 const me = await api<{ email: string }>("/v1/me", {
5 authenticated: true,

whenfilmedmain.tsx7 matches

@tmcw•Updated 10 months ago
13}
14
15async function fetchRandomMovies() {
16 const currentYear = new Date().getFullYear()
17 const movies = []
35}
36
37function generateQuizHTML(movies, uuid) {
38 const currentYear = new Date().getFullYear()
39 return `
52 </style>
53 <script>
54 function updateInputs(index, value) {
55 document.getElementById('guess' + index).value = value;
56 document.getElementById('guessInput' + index).value = value;
91}
92
93function calculateScore(movies, guesses) {
94 return movies.reduce((score, movie, index) => {
95 const actualYear = new Date(movie.release_date).getFullYear()
102}
103
104function generateResultsHTML(movies, guesses, score) {
105 return `
106 <html>
152}
153
154function generateAllGuessesHTML(allGuesses) {
155 return `
156 <html>
198}
199
200export default async function main(req: Request): Promise<Response> {
201 const { author, name } = extractValInfo(import.meta.url)
202 const guessesKey = `${author}.${name}.guesses`

generateOpenGraphTagsmain.tsx3 matches

@dthyresson•Updated 10 months ago
7}
8
9export function generateOpenGraphTags(data: OpenGraphData): string {
10 const { title, description, image, url, type = "website" } = data;
11
19}
20
21// Helper function to escape HTML special characters
22function escapeHtml(str: string): string {
23 return str
24 .replace(/&/g, "&amp;")

caniuse_notifiermain.tsx2 matches

@gunnnnii•Updated 10 months ago
7const dataKey = "caniuse-data";
8
9function Feature({ feature }: any) {
10 const links = feature.links ?? [];
11 return (
27}
28
29export default async function(interval: Interval) {
30 const previousDataUpdatedAt = await blob.getJSON(updatedKey) ?? 0;
31 const previousData = await blob.getJSON(dataKey);

twitterRAGmain.tsx1 match

@levi•Updated 10 months ago
58
59// Render streaming markdown
60export default async function handler(req: Request): Promise<Response> {
61 const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default;
62 return renderMarkdown(stream);

intromain.tsx1 match

@cw12•Updated 10 months ago
10const stream = await substrate.stream(summary);
11
12export default async function render(req: Request): Promise<Response> {
13 if (new URL(req.url).pathname === "/robots.txt") {
14 return new Response("User-agent: *\nDisallow: /");

valmain.tsx2 matches

@dvdsgl•Updated 10 months ago
3type Handler<T> = (req: Request) => T;
4
5export function http<E>(effect: Handler<Effect.Effect<Response, E>>): Handler<Promise<Response>> {
6 return async req => {
7 const exit = await Effect.runPromiseExit(effect(req));
13}
14
15export function requestJSON<T>(r: Request) {
16 return Effect.tryPromise(() => r.json() as Promise<T>).pipe(
17 Effect.catchAll(() => Effect.fail(`Could not parse Request as JSON`)),

sqliteAdminREADME.md1 match

@kamalnrf•Updated 10 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
tuna

tuna9 file matches

@jxnblk•Updated 5 hours ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.