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=2475&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 27882 results for "function"(5347ms)

pinkDinosaurmain.tsx5 matches

@AP123•Updated 10 months ago
6];
7
8// Function to generate HTML for the prompt selector
9function generatePromptSelector() {
10 const options = prompts.map(prompt => `<option value="${prompt}">${prompt}</option>`).join("");
11
35 </div>
36 <script>
37 function handlePromptSelection() {
38 const select = document.getElementById('promptSelect');
39 const result = document.getElementById('result');
54}
55
56// HTTP handler function
57export async function promptSelectorHandler(req) {
58 const html = generatePromptSelector();
59 return new Response(html, {

linkInBioTemplatemain.tsx1 match

@AP123•Updated 10 months ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

linkInBioTemplatemain.tsx1 match

@hbcoop•Updated 10 months ago
49};
50
51export default async function handler(req: Request): Promise<Response> {
52 const html = renderToString(
53 <html>

sqliteExplorerAppREADME.md1 match

@samwho•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

valwriter_outputmain.tsx1 match

@janpaul123•Updated 10 months ago
5import axios from "npm:axios@0.21.1";
6
7export default async function main() {
8 // Fetch weather data for Brooklyn, NY
9

resolvemain.tsx1 match

@martinrempel•Updated 10 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const domain = url.searchParams.get("domain");

citiesmain.tsx4 matches

@mxdvl•Updated 10 months ago
8)`);
9
10function two_decimals(number: number) {
11 return round(number, 2);
12}
20});
21
22async function add_city(coordinates: Coordinates): Promise<string> {
23 const searchParams = new URLSearchParams({
24 q: [
51type Coordinates = readonly [number, number];
52
53export async function city(coordinates: Coordinates): Promise<string> {
54 const key = coordinates.map(two_decimals).join(",");
55
64}
65
66export default async function(request: Request): Promise<Response> {
67 const searchParams = new URL(request.url).searchParams;
68

websimmain.tsx1 match

@cofsana•Updated 10 months ago
4const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
5
6export default async function render(req: Request): Promise<Response> {
7 const url = new URL(req.url);
8 const searchParams = url.searchParams;

notifymain.tsx1 match

@hlobil•Updated 10 months ago
2import process from "node:process";
3
4export async function notify(request: Request) {
5 if (request.method === "OPTIONS") {
6 return new Response("", {

staticChessREADME.md1 match

@injoon5•Updated 10 months ago
9Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
10
11Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
12
13Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

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.