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/image-url.jpg%20%22Image%20title%22?q=function&page=2659&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 29319 results for "function"(4068ms)

nighthawksChatmain.tsx4 matches

@yawnxyz•Updated 1 year ago
10const kv = new KV();
11
12async function generateText(prompt, charId) {
13 if (charId) {
14 await nighthawks.loadCharacter(charId);
23}
24
25async function createCharacter(obj) {
26 console.log('Creating character with:', obj)
27 await nighthawks.createCharacter(obj);
31}
32
33async function saveCharacter(char) {
34 console.log('Saving character:', char)
35 await nighthawks.saveCharacter(char);
38
39
40async function getStoredCharacter(charId) {
41 await nighthawks.loadCharacter(charId);
42 if (nighthawks.characters.length > 0) {

sqlite_admin_tablemain.tsx1 match

@todepond•Updated 1 year ago
3import { css } from "https://esm.town/v/stevekrouse/sqlite_admin_css";
4
5export async function sqlite_admin_table(name: string) {
6 if (!name.match(/^[A-Za-z_][A-Za-z0-9_]*$/)) return <>Invalid table name</>;
7 let data = await sqlite.execute(`SELECT * FROM ${name}`);

booksmain.tsx2 matches

@laidlaw•Updated 1 year ago
7const openai = new OpenAI();
8
9function esmTown(url) {
10 return fetch(url, {
11 headers: {
92});
93
94export async function getBooks(file: File) {
95 const dataURL = await fileToDataURL(file);
96 try {

ideasmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}
2import { Context, Hono } from "npm:hono";
3
4// Define the route handler function
5export const Time_Blindness_Loud_Calendar_via_iOS_shortcuts = (c: Context) => {
6 console.log("Route accessed: Time_Blindness_Loud_Calendar_via_iOS_shortcuts");

key_safe_linkmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

favFarmmain.tsx1 match

@stevekrouse•Updated 1 year ago
81 dangerouslySetInnerHTML={{
82 __html: `
83 function copyToClipboard(codeEl) {
84 navigator.clipboard.writeText(codeEl.innerText);
85 codeEl.classList.add('hl');

weatherGPTmain.tsx1 match

@jcoleman•Updated 1 year ago
38console.log(text);
39
40export async function weatherGPT() {
41 await email({ subject: "Weather Today", text });
42}

preactExamplemain.tsx2 matches

@tfayyaz•Updated 1 year ago
3import { render } from "npm:preact-render-to-string";
4
5function Car(props) {
6 return <h2>Hi, I am a {props.color} component Car!</h2>;
7}
8
9function Garage() {
10 return (
11 <>

aiImageExamplemain.tsx3 matches

@yawnxyz•Updated 1 year ago
2import { z } from "npm:zod";
3
4// Function to handle image and text input using OpenAI's GPT-4-turbo
5async function handleImageChat() {
6 const initialMessages = [
7 { role: "system", content: "You are a helpful assistant." },
30}
31
32// Run the function
33await handleImageChat();
34
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.