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=1341&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 18323 results for "function"(1211ms)

val_PNwC0nefnJmain.tsx1 match

@dhvanil•Updated 5 months ago
1
2 export async function val_PNwC0nefnJ(req) {
3 try {
4 // Execute the code directly and capture its result

web_kH7d5ah6xzmain.tsx1 match

@dhvanil•Updated 5 months ago
1
2 export async function web_kH7d5ah6xz(req) {
3 return new Response(`<!DOCTYPE html>
4<html>

web_whzyD0pbS0main.tsx1 match

@dhvanil•Updated 5 months ago
1
2 export async function web_whzyD0pbS0(req) {
3 return new Response(`<!DOCTYPE html>
4<html>

web_YeFlAqrDrRmain.tsx1 match

@dhvanil•Updated 5 months ago
1
2 export async function web_YeFlAqrDrR(req) {
3 return new Response(`<!DOCTYPE html>
4<html>

web_Zw1Asa4o7Vmain.tsx2 matches

@dhvanil•Updated 5 months ago
1
2 export async function web_Zw1Asa4o7V(req) {
3 return new Response(`<!DOCTYPE html>
4<html>
83 <script>
84 // Add some paranoid interactivity
85 document.addEventListener('mousemove', function(e) {
86 if(Math.random() < 0.01) {
87 const warning = document.createElement('div');

sqlitemain.tsx7 matches

@crazytown•Updated 5 months ago
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
49}
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
64}
65
66function createResError(body: string) {
67 try {
68 const e = zLibsqlError.parse(JSON.parse(body));
85}
86
87function normalizeStatement(statement: InStatement, args?: InArgs) {
88 if (Array.isArray(statement)) {
89 // for the case of an array of arrays
107}
108
109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110 return {
111 ...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
120 columns: Array<string>,

emailEchomain.tsx1 match

@sumansaurabh91•Updated 5 months ago
2import { thisEmail } from "https://esm.town/v/stevekrouse/thisEmail";
3
4export const emailEcho = async function(e: Email) {
5 return await email({
6 to: e.from,

passionateScarletPrawnmain.tsx3 matches

@stevekrouse•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [useProModel, setUseProModel] = useState(false);
77}
78
79function client() {
80 createRoot(document.getElementById("root")).render(<App />);
81}
85}
86
87export default async function server(request: Request): Promise<Response> {
88 if (request.method === "GET") {
89 return new Response(

laudableFuchsiaMastodonmain.tsx3 matches

@stevekrouse•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [useProModel, setUseProModel] = useState(false);
72}
73
74function client() {
75 createRoot(document.getElementById("root")).render(<App />);
76}
80}
81
82export default async function server(request: Request): Promise<Response> {
83 if (request.method === "POST") {
84 const { prompt, useProModel } = await request.json();

shirtGenScriptmain.tsx1 match

@stevekrouse•Updated 5 months ago
1export default async function server(request: Request): Promise<Response> {
2 if (request.method !== "POST") {
3 return new Response("Method Not Allowed", { status: 405 });

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
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.