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=1598&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 18856 results for "function"(2105ms)

valTownChatGPTmain.tsx3 matches

@xuybin•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 };

openAIStreamingREADME.md1 match

@xuybin•Updated 11 months ago
121. **Random Joke Generator:** Fetch a random joke from an API and display it.
132. **Daily Weather Update:** Pull weather data for your location using an API and create a daily summary.
143. **Mini Todo List:** Create a simple to-do list app with add, edit, and delete functionalities.
154. **Chuck Norris Facts:** Display a random Chuck Norris fact sourced from an API.
165. **Motivational Quote of the Day:** Fetch and display a random motivational quote each day.

openAIStreamingmain.tsx1 match

@xuybin•Updated 11 months ago
19const messages = ["What should I build today?", "Very cool. Can you make it even cooler?"];
20
21export default async function(req: Request): Promise<Response> {
22 const url = new URL(req.url);
23 if (url.pathname === "/favicon.ico") {

vscodemain.tsx1 match

@xuybin•Updated 11 months ago
3import { Hono } from "npm:hono@3.11.8";
4
5const script = `Object.keys(self.webPackagePaths).map(function (key, index) {
6 self.webPackagePaths[
7 key

feedsmain.tsx1 match

@nws•Updated 11 months ago
1import { states } from "https://esm.town/v/jordan/states";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5

Biomain.tsx1 match

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

amaranthPlanarianmain.tsx1 match

@ikbear•Updated 11 months ago
4const query = "\"val.town\" OR \"val town\" -_ValTown_ -is:retweet";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 const results = await twitterSearch({
8 query,

twitterAlertmain.tsx2 matches

@ikbear•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: [

aqimain.tsx1 match

@chen•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 = "narberth, pa"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

upload_jsonmain.tsx1 match

@stevedylandev•Updated 11 months ago
1const JWT = Deno.env.get("PINATA_JWT");
2async function pinJSONToIPFS() {
3 try {
4 const data = JSON.stringify({

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
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.