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=1609&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 18949 results for "function"(2487ms)

valwriter_react_clientsidemain.tsx3 matches

@stevekrouse•Updated 11 months ago
34});
35
36export function App() {
37 const example = examples[Math.floor(Math.random() * examples.length)];
38 const description = /* c.req.query("description") || */ example.user;
92 user: "website that shows the current time",
93 content: `/** @jsxImportSource npm:react */
94export default function() {
95 return <h1>{new Date().toLocaleTimeString()}</h1>;
96}`,
108];
109
110export async function compile(description: string) {
111 const messages = [
112 {

jamesWebbImageProxymain.tsx1 match

@maxm•Updated 11 months ago
1export default async function(req: Request) {
2 const body = (await fetch("https://live.staticflickr.com/65535/53782948438_9b85e57a6c_o_d.png")).body
3 return new Response(body, {headers: {"Content-Type": "image/png"}});

linkInBioTemplatemain.tsx1 match

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

isMyWebsiteDownmain.tsx1 match

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

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' });

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