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=1629&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 18400 results for "function"(3017ms)

renderFormAndSaveDataREADME.md1 match

@andreterron•Updated 1 year ago
1# Render form and save data
2
3This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data.
4
5Fork this val to customize it and use it on your account.

myApimain.tsx1 match

@tonycheal•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

httpMockingExamplemain.tsx1 match

@tmcw•Updated 1 year ago
4 * member.
5 */
6export const httpHandler = async function(req: Request): Promise<Response> {
7 if (req.method !== "POST") return new Response("Bad request: only POST allowed", { status: 400 });
8 const body = await req.json();

httpMockingExamplemain.tsx1 match

@tmcw•Updated 1 year ago
4 * member.
5 */
6export const httpHandler = async function(req: Request): Promise<Response> {
7 if (req.method !== "POST") return new Response("Bad request: only POST allowed", { status: 400 });
8 const body = await req.json();
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(request: Request): Promise<Response> {
4 const cheerio = await import("https://esm.sh/cheerio@1.0.0-rc.12");
5 const response = await fetch("https://releases.1password.com/linux/beta/");

getLatestGitCoreVersionmain.tsx1 match

@freecrayon•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(request: Request): Promise<Response> {
4 const url = new URL(request.url);
5 const query = url.searchParams.get("query") ?? "";

DiceJSmain.tsx3 matches

@lalowebos•Updated 1 year ago
1var dice = {
2 sides: 6,
3 roll: function() {
4 var randomNumber = Math.floor(Math.random() * this.sides) + 1;
5 return randomNumber;
9// Prints dice roll to the page
10
11function printNumber(number) {
12 var placeholder = document.getElementById("placeholder");
13 placeholder.innerHTML = number;
16var button = document.getElementById("button");
17
18button.onclick = function() {
19 var result = dice.roll();
20 printNumber(result);

roseSalamandermain.tsx1 match

@andreterron•Updated 1 year ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "brooklyn navy yard"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

dailyStandupBotmain.tsx1 match

@stopachka•Updated 1 year ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function() {
4 discordWebhook({
5 url: Deno.env.get("engDiscord"),

discord_note_to_selfmain.tsx1 match

@wittjosiah•Updated 1 year ago
1export async function noteToSelf(
2 { body, dmId, userId, token }: { body: object; dmId: string; userId: string; token: string },
3) {

getFileEmail4 file matches

@shouser•Updated 1 week 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.