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=1419&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 17277 results for "function"(1857ms)

linkInBioTemplatemain.tsx1 match

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

cronLoggermain.tsx2 matches

@nbbaier•Updated 10 months ago
5import { refs } from "https://esm.town/v/stevekrouse/refs?v=11";
6
7type CronFunction = (interval: Interval) => Promise<void>;
8
9export const cronEvalLogger = (cron: CronFunction): CronFunction => {
10 let interval: Interval;
11 const cronProxy = new Proxy(cron, {

weather_forecast_in_the_morningmain.tsx1 match

@benrobo•Updated 10 months ago
106 await fetch(telegramSendUrl);
107};
108export default async function(interval: Interval) {
109 const forecast = await fetchForecast();
110 const formatted = formatWeatherForecast(forecast);

private_fal_modelmain.tsx1 match

@turbo1912•Updated 10 months ago
4import { renderToString } from "npm:react-dom/server";
5
6export default async function(interval: Interval) {
7 const result = await fal.subscribe("turbo1912/multiple-models/esrgan", {
8 input: {

valTownToSQLitemain.tsx3 matches

@pomdtr•Updated 10 months ago
33);`;
34
35function valToRow(val: Val) {
36 return [
37 val.id,
47}
48
49async function insertRows(rows, options: { table: string; driver: SqliteInterface }) {
50 const query = sql`INSERT OR REPLACE INTO ${
51 raw(options.table)
55}
56
57export async function valtownToSQLite(options?: { table?: string; driver?: SqliteInterface }) {
58 const table = options?.table || "vals";
59 const driver = options?.driver || sqlite;

valTownChatGPTmain.tsx3 matches

@mttlws•Updated 10 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 };

generatevoiceREADME.md1 match

@dglazkov•Updated 10 months ago
1An example of using [Breadboard Board as a Service](https://www.val.town/v/dglazkov/bbaas) helper script. The board converts supplied text and voice into speech using Eleven Labs API.
2
3This board is marked as `private`, which means that it requires an additional service key to function.
4
5To use:

cronEvalLoggermain.tsx2 matches

@neverstew•Updated 10 months ago
5import { refs } from "https://esm.town/v/stevekrouse/refs?v=11";
6
7type CronFunction = (interval: Interval) => Promise<void>;
8
9export const cronEvalLogger = (cron: CronFunction): CronFunction => {
10 let interval: Interval;
11 const cronProxy = new Proxy(cron, {

blobCommentsReactmain.tsx1 match

@stevekrouse•Updated 10 months ago
6import { blob } from "https://esm.town/v/std/blob?v=10";
7
8function App() {
9 const [comments, setComments] = useState();
10 const [newComment, setNewComment] = useState("");

sqliteExplorerAppREADME.md1 match

@hunty•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
37

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week 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": "*",