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=1600&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 18955 results for "function"(1398ms)

dateme_router_hydratedmain.tsx3 matches

@stevekrouse•Updated 10 months ago
9
10// Generic loader that forwards on requests for that page's JSON data
11function loader({ request }) {
12 return fetch(request, {
13 headers: {
18
19// Generic action that forwards on non-get Requests
20function action({ request }) {
21 if (request.method === "GET") { throw Error("GET not expected here - something is wrong."); }
22 return fetch(request);
23}
24
25function makeClientSide(routes) {
26 return routes.map(route => {
27 return {

dateme_routesmain.tsx1 match

@stevekrouse•Updated 10 months ago
37];
38
39function Success() {
40 return (
41 <div className="max-w-md text-lg mx-auto p-6">

dateme_home_reactmain.tsx3 matches

@stevekrouse•Updated 10 months ago
2import { useEffect, useState } from "https://esm.sh/react@18.2.0";
3
4async function getCurrentPosition(opts): Promise<GeolocationPosition> {
5 return new Promise((resolve, reject) => {
6 if (!navigator?.geolocation) {
12}
13
14async function reverseGeocodeNominat(lat, lng) {
15 const url = `https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lng}&zoom=13`;
16 const response = await fetch(url);
19}
20
21export default function Home() {
22 const [locationName, setLocationName] = useState("");
23 useEffect(() => {

dailyDadJokemain.tsx1 match

@doublelotus•Updated 10 months ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 console.log(setup, punchline);

dateme_routermain.tsx2 matches

@stevekrouse•Updated 10 months ago
13
14// Generic loader that forwards on requests for that page's JSON data
15function loader({ request }) {
16 return fetch(request, {
17 headers: {
22
23// Generic action that forwards on non-get Requests
24function action({ request }) {
25 if (request.method === "GET") { throw Error("GET not expected here - something is wrong."); }
26 return fetch(request);

dateme_react_clientmain.tsx3 matches

@stevekrouse•Updated 10 months ago
2import { action as submit_action } from "https://esm.town/v/stevekrouse/dateme_form_react";
3
4async function server(req: Request) {
5 const url = new URL(req.url);
6 if (url.pathname === "/browse") {
13}
14
15function client(req: Request) {
16 return new Response(
17 `<html>
32}
33
34export default function(req: Request) {
35 if (
36 req.headers.get("Content-Type") === "application/json"

aquaLungfishmain.tsx1 match

@iamseeley•Updated 10 months ago
5import { render } from "npm:jsonresume-theme-microdata";
6
7export default async function resumeHandler(req: Request): Promise<Response> {
8 if (req.method === "GET") {
9 try {

fuchsiaSnipemain.tsx1 match

@tmcw•Updated 10 months ago
1export default async function(req: Request): Promise<Response> {
2 const response = await fetch("http://worldtimeapi.org/api/timezone/America/New_York")
3 const timeData = await response.json()

exampleTopHackerNewsDailyEmailmain.tsx4 matches

@charlypoly•Updated 10 months ago
5import { zodToJsonSchema } from "npm:zod-to-json-schema";
6
7export default async function(interval: Interval) {
8 let html = await loadPageContent("https://news.ycombinator.com/", { textContent: false });
9
28 // we create a OpenAI Tool that takes our schema as argument
29 const extractContentTool: any = {
30 type: "function",
31 function: {
32 name: "extract_content",
33 description: "Extracts the content from the given webpage(s)",
57
58 // we retrieve the serialized arguments generated by OpenAI
59 const result = completion.choices[0].message.tool_calls![0].function.arguments;
60
61 console.log(result);

modifyImagemain.tsx1 match

@u•Updated 10 months ago
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 input: Uint8Array | "logo:",
5) {

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