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/image-url.jpg%20%22Optional%20title%22?q=function&page=2773&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 28846 results for "function"(1793ms)

syncCommentToLemmymain.tsx4 matches

@pdebie•Updated 1 year ago
3import { fetchRss } from "https://esm.town/v/pdebie/fetchRss";
4
5export async function syncCommentToLemmy(
6 instance: string,
7 redditUrl: string,
10 matcher?: (author: string, content: string) => boolean,
11) {
12 function hashCode(str) {
13 let hash = 0;
14 for (let i = 0, len = str.length; i < len; i++) {
21 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
22 let client = new LemmyHttp(`https://${instance}`, {
23 fetchFunction: fetch,
24 });
25 // (client as any)["#fetchFunction"] = fetch;
26 let comments = (await fetchRss(redditUrl)).filter((i) =>
27 new Date(i.isoDate) >= new Date(Date.now() - 1000 * 60 * 60 * 24)

myApimain.tsx1 match

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

myApimain.tsx1 match

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

fetchHtmlDommain.tsx1 match

@aeaton•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchHtmlDom(url: string) {
4 const { DOMParser } = await import(
5 "https://deno.land/x/deno_dom/deno-dom-wasm.ts"

myApimain.tsx1 match

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

updateISBNFilemain.tsx1 match

@octref•Updated 1 year ago
2import { ghContent } from "https://esm.town/v/octref/ghContent";
3
4export async function updateISBNFile(isbn: string) {
5 const ISBN_PATH = "data/mine/books-isbn.json";
6 const content = await ghContent(ISBN_PATH);

myApimain.tsx1 match

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

nearestOpenStationmain.tsx1 match

@guscuddy•Updated 1 year ago
4 lon = +lon;
5 lat = +lat;
6 function dist(station) {
7 return Math.sqrt(
8 Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2),

myReactComponentmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
1// assumes React is in scope, and returns a valid HTML script string for rendering a React Component
2export function myReactComponent() {
3 return `
4const Example = () => {

arraysAreIdenticalmain.tsx1 match

@g000m•Updated 1 year ago
1export function arraysAreIdentical(arr1, arr2) {
2 if (arr1.length !== arr2.length) {
3 return false;
tuna

tuna9 file matches

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