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=1594&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 18794 results for "function"(1627ms)

valTownChatGPTmain.tsx3 matches

@maxm•Updated 11 months ago
13
14const clientCode = () => {
15 document.getElementById("input").addEventListener("submit", async function(event) {
16 event.preventDefault();
17
45 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
46 );
47 eventSource.onmessage = function(event) {
48 console.log(event);
49 responseDiv.innerText += JSON.parse(event.data);
50 };
51
52 eventSource.onerror = function() {
53 eventSource.close();
54 };

SidebarToArchivemain.tsx7 matches

@yawnxyz•Updated 11 months ago
16const sema = new Sema(5); // Adjust the number based on your desired concurrency
17
18export async function addLinksToSheet(links) {
19 let counter = 0;
20 for (const link of links) {
43}
44
45export async function getSidebar(limit = 1, start = 0) {
46 const gql = {
47 "operationName": "posts",
112
113
114// Function to escape double quotes in a CSV field
115function escapeCSVField(field) {
116 if(!field) return '""';
117 return `"${field.replace(/"/g, '""')}"`;
118}
119
120// Function to convert links to CSV
121function convertToCSV(links) {
122 const header = ["Title", "Body", "URL", "PostedAt", "CreatedAt", "Data"];
123 const rows = links.map(link => [
132}
133
134async function getAllLinks(totalLimit, offset=0) {
135 let allLinks = [];
136 const limit = 1000; // Adjust this according to the server's limit

chatGPTmain.tsx3 matches

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

twitterAlertmain.tsx2 matches

@seflless•Updated 11 months ago
27const openai = new OpenAI();
28
29export async function twitterAlert({ lastRunAt }: Interval) {
30 let results = [];
31 for (const username of usernames) {
36 }
37
38 async function filterTweets(tweets) {
39 const completion = await openai.chat.completions.create({
40 messages: [

twitterDailyDigestmain.tsx2 matches

@geoffreylitt•Updated 11 months ago
27const openai = new OpenAI();
28
29export async function twitterAlert({ lastRunAt }: Interval) {
30 let results = [];
31 for (const username of usernames) {
36 }
37
38 async function filterTweets(tweets) {
39 const completion = await openai.chat.completions.create({
40 messages: [

lunrSearchDemomain.tsx1 match

@yawnxyz•Updated 11 months ago
1import lunr from 'https://cdn.skypack.dev/lunr';
2
3const idx = lunr(function () {
4 this.field('content');
5 this.add({ id: 1, content: 'Banana Apples and Oranges' });

getTweetsmain.tsx2 matches

@geoffreylitt•Updated 11 months ago
16}
17
18// Function to fetch tweets from a user
19export async function getTweets(username: string) {
20 const userUrl = `https://api.twitter.com/2/users/by/username/${username}`;
21 const userResponse = await fetch(userUrl, {

sqliteExplorerAppREADME.md1 match

@dtkav•Updated 11 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
37

uptimemain.tsx1 match

@cn_d_•Updated 11 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;

oceanThememain.tsx1 match

@iamseeley•Updated 11 months ago
166 border-radius: 50%;
167 animation: rise infinite;
168 animation-timing-function: linear;
169 }
170

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": "*",