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/$%7Bart_info.art.src%7D?q=function&page=2670&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 29303 results for "function"(6757ms)

reppmain.tsx5 matches

@maxm•Updated 1 year ago
52
53// The script we run within the worker. Don't reference anything
54// outside of this function as it won't be available within the worker. We could even host this in a separate val and pass
55const workerScript = () => {
56 type Log = {
64 get(target, key) {
65 const real = target[key];
66 if (typeof real === "function" && typeof key === "string") {
67 const fn = function(...args: any[]) {
68 logs.push({
69 level: key,
79 },
80 });
81 async function evaluate(url) {
82 try {
83 const _ = await import(url);
170
171// // evaluate("let ten = 10");
172// // evaluate("function cube(x) { return x ** 3 }");
173// // evaluate("ten + cube(3)");
174// evaluate(`

pipedreammain.tsx3 matches

@stevekrouse•Updated 1 year ago
2import { google } from "npm:googleapis";
3
4export async function getAccessToken(accountId: string, bearer = Deno.env.get("pipedream")) {
5 const response = await fetchJSON(
6 `https://api.pipedream.com/v1/accounts/${accountId}?include_credentials=1`,
10}
11
12export function googleService(service: string, accessToken: string) {
13 return google[service]({
14 version: "v3",
19}
20
21export async function pipeDreamGoogle(service: string, accountId: string, bearer = Deno.env.get("pipedream")) {
22 const accessToken = await getAccessToken(accountId, bearer);
23 return googleService(service, accessToken);

ProfilePagemain.tsx1 match

@iamseeley•Updated 1 year ago
12}
13
14export default function ProfilePage({ username, name, bio, links, title }: ProfilePageProps) {
15
16 return (

MapUsermain.tsx1 match

@iamseeley•Updated 1 year ago
10}
11
12export default function MapboxComponent({ city }: MapboxProps) {
13 const mapContainer = <div id="map" style={{ width: '100%', height: '400px' }}></div>;
14

pipedreamREADME.md3 matches

@stevekrouse•Updated 1 year ago
3Pipedream offers an Accounts API to handle OAuth for you, automatically, and for free. [How to do it is covered in this guide](https://docs.val.town/integrations/google-sheets/#use-pipedreams-accounts-api).
4
5The helper functions below can make it easier to work with various Google API. For example, I used them like so to get all my free/busy times for this week from all my google calendars:
6
7```ts
11const calendar = await pipeDreamGoogle("calendar", accountId);
12
13// Function to get free/busy information
14async function getFreeBusyTimes(calendarId: string) {
15 const now = new Date();
16 const startOfWeek = new Date(now);

aqimain.tsx1 match

@yacosta738•Updated 1 year ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "46025, Benicalap, Valencia, Spain"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

gptApiSchemaBuildermain.tsx3 matches

@xkonti•Updated 1 year ago
3import { zodToJsonSchema } from "npm:zod-to-json-schema";
4
5export function getSchemaDesc(schema: z.Schema) {
6 return zodToJsonSchema(schema, {
7 name: "schema",
24}
25
26export function getPathsDesc(endpoints: EndpointDefinition[]) {
27 const paths: any = {};
28 for (const endpoint of endpoints) {
61}
62
63export function getOpenApiSpec(
64 url: string,
65 title: string,

testPostToMastodonmain.tsx1 match

@geraldo•Updated 1 year ago
1import { postToMastodon } from "https://esm.town/v/sebdd/postToMastodon";
2
3export function testPostToMastodon() {
4 let response = postToMastodon(
5 "https://floss.social/api/v1",

staticChessREADME.md1 match

@avkv•Updated 1 year ago
6Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
7
8Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
9
10Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

decorator_routermain.tsx4 matches

@yieldray•Updated 1 year ago
18}
19
20export function get(path: string) {
21 return (
22 target: (query: Record<string, string>, ctx: Context) => unknown,
37}
38
39export function post(path: string) {
40 return (target: (body: any, ctx: Context) => unknown, _context: ClassMethodDecoratorContext) => {
41 _registered.push({ method: "POST", path });
49}
50
51export function all(path: string) {
52 return (target: (ctx: Context) => unknown, _context: ClassMethodDecoratorContext) => {
53 _registered.push({ method: "*", path });
61}
62
63export function use(path: string) {
64 return (target: (ctx: Context) => unknown, _context: ClassMethodDecoratorContext) => {
65 app.use(path, async (request: Request, { params, next }) => {
tuna

tuna9 file matches

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