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=1553&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 18147 results for "function"(3315ms)

linearRegressionmain.tsx1 match

@iamseeley•Updated 11 months ago
30
31 <script>
32 async function main() {
33 let pyodide = await loadPyodide();
34 await pyodide.loadPackage(['numpy', 'pandas', 'scikit-learn', 'matplotlib']);

codemirrorTsBrowserREADME.md2 matches

@maxm•Updated 11 months ago
10import { renderToString } from "npm:react-dom/server";
11
12export default async function(req: Request): Promise<Response> {
13 return new Response(
14 renderToString(
19 {`let hasAnError: string = 10;
20
21function increment(num: number) {
22 return num + 1;
23}

companiesHousePublicDatamain.tsx1 match

@aeaton•Updated 11 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const path = url.searchParams.get("path");

emojiGuessrmain.tsx1 match

@jdan•Updated 11 months ago
6import { Hono } from "npm:hono@3";
7
8function esmTown(url) {
9 return fetch(url, {
10 headers: {

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);

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": "*",