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=2664&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 28792 results for "function"(2085ms)

ssr_a_web_component_for_funmain.tsx2 matches

@brianleroux•Updated 1 year ago
1import enhance from "jsr:@enhance/ssr";
2
3export default async function() {
4 let html = enhance({
5 elements: {
6 "my-tag": function({ html }) {
7 return html`<b><slot></slot></b>`;
8 },

tapMochaToNodemain.tsx9 matches

@barelyhuman•Updated 1 year ago
6run();
7
8async function run() {
9 if (!import.meta.main) return;
10
42}
43
44export function transform(code: string, { typescript = false } = {}) {
45 const parserOptions: Partial<recast.Options> = {};
46
125}
126
127function removeMochaGlobal(
128 path: NodePath,
129 tapImportIdentifier: string,
161}
162
163function makeBlocksAsync(
164 path: NodePath,
165 {
188
189 const fnNode = path.node.arguments[1];
190 makeFunctionNodeAsync(fnNode, { asserts });
191 awaitNestedStatements(path, { asserts, builder });
192
194}
195
196function makeFunctionNodeAsync(
197 node: any,
198 {
204 if (
205 !(
206 asserts.ArrowFunctionExpression.check(node) ||
207 asserts.FunctionExpression.check(node)
208 )
209 ) {
214}
215
216function awaitNestedStatements(
217 path: NodePath,
218 {

notehubREADME.md1 match

@rdimartino•Updated 1 year ago
1# Notehub
2
3A set of helper functions for interacting with the Notehub API
4
5Requires `NOTEHUB_CLIENT_ID` and `NOTEHUB_CLIENT_SECRET` [environment variables](https://www.val.town/settings/environment-variables) to be configured.

sleepmain.tsx1 match

@neverstew•Updated 1 year ago
1export function sleep(milliseconds = 3000) {
2 return new Promise(resolve => setTimeout(resolve, milliseconds));
3}

sleepmain.tsx1 match

@mxdvl•Updated 1 year ago
1export function sleep(milliseconds = 3000) {
2 return new Promise(resolve => setTimeout(resolve, milliseconds));
3}

roundmain.tsx1 match

@mxdvl•Updated 1 year ago
1/** round with abitrary decimal precision */
2export function round(number: number, precision = 5) {
3 return Math.round(number * Math.pow(10, precision)) / Math.pow(10, precision);
4}

btcPriceAlertmain.tsx1 match

@dantaeyoung•Updated 1 year ago
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8

staleGithubPRsEmailmain.tsx2 matches

@andreterron•Updated 1 year ago
5// Sends an email with all the open PRs that have not had any activity
6// for specified period of days
7// Set up this function to run every day (or any interval)
8export async function staleGithubPRsEmail() {
9 // Set up a secret named githubRepos with all the repos you want to analyze (comma separated)
10 let repos = Deno.env.get("githubRepos")?.split(",").filter((r) => r.trim()) ?? [];

cdnmain.tsx2 matches

@pomdtr•Updated 1 year ago
3import { readmeToHtmlResponse } from "https://esm.town/v/pomdtr/readme";
4
5async function createScreenshot(code: string) {
6 const apiUrl = "https://sourcecodeshots.com/api/image";
7 const resp = await fetch(apiUrl, {
19}
20
21export default async function(req: Request) {
22 const url = new URL(req.url);
23 const [author, file] = url.pathname.slice(1).split("/");

htmlExamplemain.tsx1 match

@andreterron•Updated 1 year ago
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3 const query = new URL(req.url).searchParams;
4

getFileEmail4 file matches

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