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=2499&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 28854 results for "function"(2752ms)

typingTestSpectrogrammain.tsx4 matches

@ejfox•Updated 9 months ago
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9function App() {
10 const [input, setInput] = useState("");
11 const [currentIndex, setCurrentIndex] = useState(0);
18
19 const text = `
20function quickSort(arr) {
21 if (arr.length <= 1) {
22 return arr;
172}
173
174function client() {
175 console.log("Client-side code running");
176 createRoot(document.getElementById("root")).render(<App />);
178if (typeof document !== "undefined") { client(); }
179
180async function server(request: Request): Promise<Response> {
181 return new Response(`
182 <html>

aqimain.tsx1 match

@hamzaniau•Updated 9 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "Detroit MI"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

solidExamplemain.tsx2 matches

@mhalle•Updated 9 months ago
2import { renderToString } from "npm:solid-js/web";
3
4function calc() {
5 return 4 + 5;
6}
7function getMarkup() {
8 return <div>Test {calc()}</div>;
9}

twitterAlertmain.tsx2 matches

@marianogenovese•Updated 9 months ago
11// const query = `${baseQuery}`.trim();
12// console.log(Deno.env.get("twitter"));
13// export async function twitterAlert() {
14// const results = await twitterSearch({
15// query,
34// }
35
36export async function main() {
37 console.log("ok");
38}

exponentialBackoffMiddlewaremain.tsx3 matches

@stevekrouse•Updated 9 months ago
8 * @param http handler
9 */
10export function exponentialBackoffMiddleware(
11 handler: (req: Request) => Response | Promise<Response>,
12): (req: Request) => Promise<Response> {
50}
51
52// Helper function to parse cookies
53function parseCookies(cookieString: string): Record<string, string> {
54 return cookieString.split(";").reduce((cookies, cookie) => {
55 const [name, value] = cookie.trim().split("=");

valleBlogV0main.tsx3 matches

@trantion•Updated 9 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [password, setPassword] = useState("");
7 const [length, setLength] = useState(12);
110}
111
112function client() {
113 createRoot(document.getElementById("root")).render(<App />);
114}
118}
119
120export default async function server(request: Request): Promise<Response> {
121 return new Response(`
122 <!DOCTYPE html>

linkInBioTemplatemain.tsx1 match

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

dailyDadJokemain.tsx1 match

@cpdis•Updated 9 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 return email({

convertRelativeDateToStringmain.tsx1 match

@sarahxc•Updated 9 months ago
1export async function convertRelativeDateToString({
2 relativeDate = "0 days ago", // Default search if no query is provided
3}: {

convertRelativeDateToStringmain.tsx1 match

@alexdphan•Updated 9 months ago
1export async function convertRelativeDateToString({
2 relativeDate = "0 days ago", // Default search if no query is provided
3}: {
tuna

tuna9 file matches

@jxnblk•Updated 8 hours ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.