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/$%7Burl%7D?q=function&page=2639&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 29089 results for "function"(1764ms)

bloomingButtonREADME.md1 match

@maxm•Updated 1 year ago
11import { renderToString } from "npm:react-dom/server";
12
13export default async function(req: Request): Promise<Response> {
14 return new Response(
15 renderToString(

htmlExamplemain.tsx1 match

@todepond•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

uniswapV3PositionREADME.md4 matches

@midnightlightning•Updated 1 year ago
11This val fetches blockchain data from the following smart contracts:
12
13- **NonfungiblePositionManager(`0xc36442b4a4522e871399cd717abdd847ab11fe88`)** Manages the liquidity position tokens as an ERC721 contract. The `positions` function is used to determine what tokens and tick ranges the individual liquidity position has.
14- **UniswapV3Factory (`0x1F98431c8aD98523631AE4a59f267346ea31F984`)** Contract that manages liquidity pools, and acts as a registry to record where each pairing is deployed to. The `getPool` function is used to find where the smart contract for a specific pairing of ERC20 tokens is deployed to.
15- **ERC20 tokens** Each position has two tokens it's balancing between, and each token has its own instance of an ERC20 contract deployed to the blockchain. The `name` and `symbol` functions are used to determine how to describe each token, and the `decimals` function to determine how to scale the price value for the ratio between them.
16- **UniswapV3Pool** Contract that handles swaps between specific pairs of tokens. The `slot0` function is used to fetch the current price the two tokens are swapping at.

valTownAnalyticsmain.tsx1 match

@iamseeley•Updated 1 year ago
94};
95
96async function handler(req: Request): Promise<Response> {
97 const url = new URL(req.url);
98 if (req.method === "GET" && url.pathname === "/event") {

allValsmain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
4
5function truncate(str: string) {
6 if (str.length > 20) {
7 return `${str.slice(0, 20)}...`;

pinBlobmain.tsx1 match

@stevedylandev•Updated 1 year ago
2const JWT = Deno.env.get("PINATA_JWT");
3
4async function pinFileToIPFS() {
5 try {
6 const text = "Hello World!";

posthogGitHubStarCapturemain.tsx1 match

@wcbudz•Updated 1 year ago
1import { capturePostHogEvent } from "https://esm.town/v/ianvph/capturePostHogEvent";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return Response.json({ ok: "only post request" });

httpStatusBehaviormain.tsx1 match

@maxm•Updated 1 year ago
11];
12
13export default async function(req: Request): Promise<Response> {
14 const url = new URL(req.url);
15 if (url.pathname === "/") {

resumeRecsmain.tsx1 match

@iamseeley•Updated 1 year ago
3const tokenBucket = new TokenBucket(5, 1/12);
4
5export async function getRecommendations(jobDescription, resume, apiKey) {
6
7 if (!tokenBucket.consume()) {

imgGenUrlmain.tsx1 match

@martinbowling•Updated 1 year ago
6};
7
8export default async function(req: Request): Promise<Response> {
9 let key = new URL(req.url).pathname;
10
tuna

tuna9 file matches

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