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=2684&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 28734 results for "function"(7927ms)

quinemain.tsx1 match

@maxmUpdated 1 year ago
1export function quine() {
2 return `${quine}`;
3}

getMemain.tsx1 match

@stevekrouseUpdated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function getMe(): Promise<{ username: string; id: string; profileImageUrl; bio: string }> {
4 return fetchJSON("https://api.val.town/v1/me", {
5 headers: {

codeOnValTownREADME.md1 match

@andreterronUpdated 1 year ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

myApimain.tsx1 match

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

sqliteTableExportUtilsmain.tsx3 matches

@stevekrouseUpdated 1 year ago
3import { DataType, Float64, Int32, Table, tableToIPC, Utf8, vectorFromArray } from "npm:apache-arrow";
4
5// Function to map SQLite data types to Apache Arrow data types
6function sqliteTypeToArrowType(sqliteType: string): DataType {
7 switch (sqliteType.toUpperCase()) {
8 case "INTEGER":
20export type SQLiteTableExportFormat = "json" | "arrowIPC";
21
22export async function exportSQLiteTable(
23 tableName: string,
24 format: SQLiteTableExportFormat,
10import { exportSQLiteTable, SQLiteTableExportFormat } from "https://esm.town/v/rlesser/sqliteTableExportUtils";
11
12export default async function(req: Request): Promise<Response> {
13 const tableName = new URL(req.url).searchParams.get("table");
14 if (!tableName) {

market_kelly_betmain.tsx3 matches

@caseUpdated 1 year ago
9
10// Copied from https://github.com/Will-Howard/manifolio/blob/master/manifolio-ui/lib/calculate.ts
11function calculateNaiveKellyBet({
12 marketProb,
13 estimatedProb,
34}
35
36async function getMarket(slug: string) {
37 const res = await fetch(`https://api.manifold.markets/v0/slug/${slug}`);
38
45}
46
47export default async function(req: Request): Promise<Response> {
48 const searchParams = new URL(req.url).searchParams;
49 const params = paramsSchema.parse(Object.fromEntries(searchParams.entries())) as z.infer<typeof paramsSchema>;

aspBadgeREADME.md1 match

@vladimyrUpdated 1 year ago
17[🔬️ inspect ASP JWT token](https://vladimyr-aspe_inspector.web.val.run/aspe:keyoxide.org:TOICV3SYXNJP7E4P5AOK5DHW44)
18
19Badge with new ASPE URI (not functional yet ⚠️):
20[![](https://vladimyr-aspbadge.web.val.run/aspe:fe7b75c54b95ac019dd48fbefe8d654af383cbfe)](https://keyoxide.org/aspe:fe7b75c54b95ac019dd48fbefe8d654af383cbfe)
21

getThreadsActivitymain.tsx3 matches

@glommerUpdated 1 year ago
11});
12
13async function getKnownThreads() {
14 const result = await db.select().from(threadsTbl);
15 return result.reduce((r, { id, last_message_id }) => {
19}
20
21async function getNewThreads() {
22 const resp = await fetch(`https://discord.com/api/guilds/${guild}/threads/active`, {
23 headers: {
34}
35
36export async function getThreadsActivity(
37 token: string,
38 guild: string,

val2imgmain.tsx1 match

@pomdtrUpdated 1 year ago
3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
4
5export default async function(ctx: BrowserContext<{ author: string; name: string }>) {
6 const { author, name } = ctx.params;
7 const title = `@${author}/${name}`;

getFileEmail4 file matches

@shouserUpdated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 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.