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=1555&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 18163 results for "function"(2966ms)

gpt4o_emojimain.tsx1 match

@jdan•Updated 11 months ago
1import { chat } from "https://esm.town/v/stevekrouse/openai?v=19";
2
3export async function getGPT4oEmoji(url) {
4 const response = await chat([
5 {

LandingPagemain.tsx1 match

@iamseeley•Updated 11 months ago
7};
8
9export default function LandingPage({ title, description }) {
10 const nowPages = [
11 {

emailGPT3main.tsx1 match

@ayush37•Updated 11 months ago
3import { runVal } from "https://esm.town/v/std/runVal";
4
5export async function emailGPT3(email) {
6 let response = await runVal("patrickjm.gpt3", { prompt: email.text });
7 return mail({

forwardermain.tsx1 match

@ayush37•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2
3export function forwarder(e: {
4 from: string;
5 to: string[];

reppmain.tsx5 matches

@maxm•Updated 11 months 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 11 months 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 11 months ago
12}
13
14export default function ProfilePage({ username, name, bio, links, title }: ProfilePageProps) {
15
16 return (

MapUsermain.tsx1 match

@iamseeley•Updated 11 months 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 11 months 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 11 months 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 });

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",