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=2087&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 22367 results for "function"(2871ms)

untitled_redCatfishmain.tsx1 match

@remelee•Updated 1 year ago
4
5// Fetches a random joke.
6async function fetchRandomJoke() {
7 const response = await fetch(
8 "https://official-joke-api.appspot.com/random_joke",

gpt4FunctionCallingExamplemain.tsx10 matches

@stevekrouse•Updated 1 year ago
2
3const openai = new OpenAI();
4const functionExpression = await openai.chat.completions.create({
5 "messages": [
6 { "role": "user", "content": "What is the weather like in Boston?" },
7 ],
8 "functions": [
9 {
10 "name": "get_current_weather",
29 max_tokens: 30,
30});
31console.log(functionExpression);
32
33// TODO pull out function call and initial message
34let args = functionExpression.choices[0].message.function_call.arguments;
35let functionCallResult = { "temperature": "22", "unit": "celsius", "description": "Sunny" };
36
37const result = await openai.chat.completions.create({
41 "role": "assistant",
42 "content": null,
43 "function_call": { "name": "get_current_weather", "arguments": "{ \"location\": \"Boston, MA\"}" },
44 },
45 {
46 "role": "function",
47 "name": "get_current_weather",
48 "content": JSON.stringify(functionCallResult),
49 },
50 ],
51 "functions": [
52 {
53 "name": "get_current_weather",

gpt4FunctionCallingExampleREADME.md1 match

@stevekrouse•Updated 1 year ago
1Migrated from folder: External_APIs/openai/function_calling/gpt4FunctionCallingExample

emailRandomJokemain.tsx1 match

@caofanny•Updated 1 year ago
2
3// fetches a random joke
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

registryExamplemain.tsx1 match

@lbb00•Updated 1 year ago
1import { html } from "https://esm.town/v/lbb00/html";
2export async function LoginRegistryExample(request: Request): Promise<Response> {
3 return new Response(
4 html`

untitled_greenCrayfishmain.tsx1 match

@mohammed•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

washer_3dmain.tsx1 match

@dupontgu•Updated 1 year ago
1export async function washer_3d(request: Request): Promise<Response> {
2 const u = new URL(request.url);
3 const params = Object.fromEntries(u.searchParams.entries());

markdocReactExamplemain.tsx2 matches

@pomdtr•Updated 1 year ago
21};
22
23function Val({ author, name }) {
24 return <iframe width="600" height="300" frameBorder="0" src={`https://www.val.town/embed/${author}/${name}`} />;
25}
26
27export async function markdocReactExample(req: Request) {
28 // extract the current val readme
29 const { author, name } = extractValInfo(import.meta.url);

georgiaTechRegistrationmain.tsx1 match

@brownieinmotion•Updated 1 year ago
4const TERM = "202402";
5
6export async function georgiaTechRegistration(request: Request): Promise<Response> {
7 const course = new URL(request.url).searchParams.get("courseId")?.toString();
8 if (course === undefined) return Response.json({ error: "missing courseId" });

getFileEmail4 file matches

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

tuna8 file matches

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