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=1616&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 19302 results for "function"(3261ms)

valTownChatGPT2main.tsx4 matches

@janpaul123•Updated 10 months ago
18};
19
20function renderForm(
21 valName: string,
22 prompt: string,
84 const writer = writable.getWriter();
85 const textEncoder = new TextEncoder();
86 function write(text) {
87 writer.write(textEncoder.encode(text));
88 }
109 (() => {
110 const scrollingElement = document.body;
111 const callback = function (mutationsList, observer) {
112 window.scrollTo({ left: 0, top: document.body.scrollHeight, behavior: "instant" });
113 };
147 role: "system",
148 content:
149 `Act as an expert software engineer. Always use best practices. Your response should start with \`\`\`ts and end with \`\`\`. Start your response with a comment explaining how your approach will work, what libraries or API calls you will use, and any tradeoffs you're making. Then write the code in a consise way, the simplest way to achieve the goal, though you can add some inline comments to explain your reasoning (not for every line, but for major groups of lines). Don't use any environment variables unless strictly necessary, for example use APIs that don't require a key, prefer internal function imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno functions where possible. The val should create a "export default async function main() {" which is the main function that gets executed, without any arguments. Don't return a Response object, just return a plain Javascript object, array, or string. Unless specified, don't add error handling, make sure that errors bubble up to the caller.`,
150 },
151 {

downloadSiteContentsmain.tsx1 match

@nvie•Updated 10 months ago
11// const KEY = "VOETBAL_SHIRT_HASH";
12
13export async function download() {
14 // Replace this URL with the website you want to track
15 const URL = "https://www.knvbshop.nl/nike-nederlands-elftal-thuisshirt-2024-2026.html#size=XL";

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;

getFileEmail4 file matches

@shouser•Updated 2 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.