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=1598&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 19450 results for "function"(3482ms)

valTownBadgeSVGmain.tsx2 matches

@jxnblk•Updated 9 months ago
9const padLeft = 48;
10
11export function Badge({
12 scale = 1,
13 label = "View source on",
66}
67
68export default async function(req: Request): Promise<Response> {
69 const svg = renderToStaticMarkup(
70 <Badge scale={1} />,

greenCowmain.tsx3 matches

@willthereader•Updated 9 months ago
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };

scarletEgretREADME.md1 match

@willthereader•Updated 9 months ago
1# OpenAI ChatGPT helper function
2
3This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free.

scarletEgretmain.tsx3 matches

@willthereader•Updated 9 months ago
1import type { ChatCompletion, ChatCompletionCreateParamsNonStreaming, Message } from "npm:@types/openai";
2
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
14/**
15 * Initiates a chat conversation with OpenAI's GPT model and retrieves the content of the first response.
16 * This function can handle both single string inputs and arrays of message objects.
17 * It supports various GPT models, allowing for flexibility in choosing the model based on the application's needs.
18 *
21 * @returns {Promise<string>} A promise that resolves to the content of the first response from the completion.
22 */
23export async function chat(
24 input: string | Message[],
25 options?: Omit<ChatCompletionCreateParamsNonStreaming, "messages">,

openaiREADME.md1 match

@willthereader•Updated 9 months ago
1# OpenAI ChatGPT helper function
2
3This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free.

openaimain.tsx3 matches

@willthereader•Updated 9 months ago
1import type { ChatCompletion, ChatCompletionCreateParamsNonStreaming, Message } from "npm:@types/openai";
2
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
14/**
15 * Initiates a chat conversation with OpenAI's GPT model and retrieves the content of the first response.
16 * This function can handle both single string inputs and arrays of message objects.
17 * It supports various GPT models, allowing for flexibility in choosing the model based on the application's needs.
18 *
21 * @returns {Promise<string>} A promise that resolves to the content of the first response from the completion.
22 */
23export async function chat(
24 input: string | Message[],
25 options?: Omit<ChatCompletionCreateParamsNonStreaming, "messages">,

chatmain.tsx3 matches

@willthereader•Updated 9 months ago
1import type { ChatCompletion, ChatCompletionCreateParamsNonStreaming, Message } from "npm:@types/openai";
2
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === @std/openai) {
14/**
15 * Initiates a chat conversation with OpenAI's GPT model and retrieves the content of the first response.
16 * This function can handle both single string inputs and arrays of message objects.
17 * It supports various GPT models, allowing for flexibility in choosing the model based on the application's needs.
18 *
21 * @returns {Promise<string>} A promise that resolves to the content of the first response from the completion.
22 */
23export async function chat(
24 input: string | Message[],
25 options?: Omit<ChatCompletionCreateParamsNonStreaming, "messages">,

chatREADME.md1 match

@willthereader•Updated 9 months ago
1# OpenAI ChatGPT helper function
2
3This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free.

jadeGophermain.tsx3 matches

@willthereader•Updated 9 months ago
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };

linkInBioTemplatemain.tsx1 match

@ghsaboias•Updated 9 months ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

getFileEmail4 file matches

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

tuna8 file matches

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