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/$%7Bart_info.art.src%7D?q=function&page=2422&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 25661 results for "function"(1749ms)

untitled_amethystStorkmain.tsx1 match

@cufaoil•Updated 1 year ago
1export async function untitled_amethystStork(request: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

htmlREADME.md1 match

@lbb00•Updated 1 year ago
1# Render html by tagged templates
2
3You can use this simple function to compose components, and you can also format the content within html`` elegantly in VSCode.
4
5## Example

lableaksmain.tsx10 matches

@jonbo•Updated 1 year ago
1export async function lableaks(request: Request): Promise<Response> {
2 // Define the HTML content
3 const htmlContent = `<!DOCTYPE html>
8 <title>WebSocket Example</title>
9 <script>
10 document.addEventListener("DOMContentLoaded", function () {
11 var ws = new WebSocket("wss://cjs-mac-mini.tail73f30.ts.net");
12 var textContainer = document.getElementById("text");
17 var id; // This will hold the id from the server response
18
19 ws.onopen = function () {
20 console.log("Connected to the WebSocket server");
21 };
23 var statusSpan = document.getElementById("status");
24
25 ws.onmessage = function (event) {
26 var data = JSON.parse(event.data);
27 id = data.id; // Assuming the id is in the server response
43 };
44
45 function sendChoice(choice) {
46 console.log("Button " + choice + " clicked");
47 ws.send(
52 })
53 );
54 // setTimeout(function () {
55 // location.reload();
56 // }, 4000);
57 }
58
59 buttonA.addEventListener("click", function () {
60 sendChoice(1);
61 });
62
63 buttonB.addEventListener("click", function () {
64 sendChoice(2);
65 });
66
67 ws.onclose = function () {
68 console.log("Disconnected from the WebSocket server");
69 };
70
71 ws.onerror = function (error) {
72 console.log("WebSocket Error: " + error);
73 };

aqiPushGotifymain.tsx1 match

@zane•Updated 1 year ago
4import process from "node:process";
5
6export async function aqiPushGotify(interval: Interval) {
7 const location = "Portland, Oregon"; // <-- change to place, city, or zip code
8 const data = await easyAQI({ location });

emailRandomJokemain.tsx1 match

@bellafratantonio•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

SAMPLE_JOKEmain.tsx1 match

@nguyentruongngu•Updated 1 year ago
7
8// Fetches a random joke.
9async function fetchRandomJoke() {
10 const response = await fetch(
11 "https://official-joke-api.appspot.com/random_joke",

emailRandomJokemain.tsx1 match

@lynnkp•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

emailRandomJokemain.tsx1 match

@roslyn_maloney•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

echoParamsmain.tsx1 match

@pomdtr•Updated 1 year ago
1import { html } from "https://esm.town/v/stevekrouse/html";
2
3export async function echoParams(
4 req: Request
5) {

emailRandomJokemain.tsx1 match

@willkbl•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month 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.