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/$%7Burl%7D?q=function&page=2089&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 22338 results for "function"(2753ms)

blogREADME.md1 match

@pomdtr•Updated 1 year ago
17import { html } from "https://esm.town/v/stevekrouse/html?v=5";
18
19export async function examplePost(req: Request) {
20 const { author, name } = extractValInfo(import.meta.url);
21 return html(await article(author, name));

emailRandomJokemain.tsx1 match

@gab0503•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

@linafu2•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

@tylerbinns•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",

setTempmain.tsx1 match

@cufaoil•Updated 1 year ago
2import { set } from "https://esm.town/v/std/set?v=11";
3
4export async function setTemp(temp: Request) {
5 const currentDate = new Date();
6 const timestamp = currentDate.getTime();

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

getFileEmail4 file matches

@shouser•Updated 4 weeks 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.