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=1580&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 18590 results for "function"(4033ms)

tldrawReactExportScriptmain.tsx1 match

@tfayyaz•Updated 11 months ago
3import { Tldraw } from "https://esm.sh/tldraw@2.1.0";
4
5export function MyApp() {
6 return (
7 <div style={{ position: "fixed", inset: 0 }}>

lavenderPinnipedREADME.md1 match

@jamisonl•Updated 11 months ago
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality

currentTimemain.tsx2 matches

@iamseeley•Updated 11 months ago
1export function currentTime(element) {
2 function update() {
3 const now = new Date();
4 const timeString = now.toLocaleTimeString();

handleDiscordInteractionREADME.md1 match

@jamisonl•Updated 11 months ago
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality

openAIHonoChatStreamExamplemain.tsx2 matches

@yawnxyz•Updated 11 months ago
57 const outputDiv = document.getElementById('output');
58
59 function getResponse() {
60 const prompt = document.getElementById('prompt').value;
61 const url = "${SOURCE_URL}/chat?p=" + encodeURIComponent(prompt);
125 const outputDiv = document.getElementById('output');
126
127 function testStream() {
128 const url = "${SOURCE_URL}/chat/test";
129 outputDiv.textContent = 'Loading...';

SteamPlaytimeHistory_exportDbToEmailmain.tsx1 match

@alvi•Updated 11 months ago
3import { json2csv } from "npm:json-2-csv";
4
5export default async function(interval: Interval) {
6 const complete_play_history = await db.select().from(play_history).all();
7

streamingGifmain.tsx1 match

@maxm•Updated 11 months ago
4
5const scale = 0.15;
6export default async function(req: Request) {
7 let timerId: number | undefined;
8 const body = new ReadableStream({

valTownChatGPTmain.tsx3 matches

@stevekrouse•Updated 11 months ago
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };

biomain.tsx1 match

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

aqimain.tsx1 match

@adrianlee•Updated 11 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "japanese prespretarian church, seattle, wa, 98144"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

getFileEmail4 file matches

@shouser•Updated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",