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=1394&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 18324 results for "function"(1267ms)

multiplayerCirclesmain.tsx6 matches

@peterqliu•Updated 7 months ago
37// });
38
39function parseResultSet<T>(row: ResultSet): T[] {
40 return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
41}
51};
52
53function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
54 const changes: Circle[] = [];
55
74
75 const drag = (() => {
76 function dragstarted() {
77 d3.select(this).attr("stroke", "black");
78 }
79
80 function dragged(event, d) {
81 d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
82 }
83
84 function dragended() {
85 const x = d3.select(this).attr("cx");
86 const y = d3.select(this).attr("cy");
105 .call(drag)
106 .on("click", clicked);
107 function clicked(event, d) {
108 if (event.defaultPrevented) return; // dragged
109

slamBotPostmain.tsx4 matches

@dupontgu•Updated 7 months ago
125]
126
127async function uploadImage(imageBuffer: any, altText: string): Promise<string> {
128 const formData = new FormData();
129 formData.append("file", new Blob([imageBuffer], { type: "image/png" }));
146}
147
148async function postStatusWithImage(statusText: string, imageBuffer: any, altText: string) {
149 const mediaId = await uploadImage(imageBuffer, altText);
150
170}
171
172async function overlayTextOnImage(slammer_text: string, slammed_text: string, imageDef: Image): Promise<Uint8Array> {
173 const image = await loadImage(imageDef.url);
174 let fontFile = await fetch(
208}
209
210export default async function generateOneMastodonPost(request: Request): Promise<Response> {
211 const inputs = (await blob.list(BLOB_PREFIX))
212 if (inputs.length == 0) {

heavenlyOrangeMarmosetmain.tsx1 match

@dupontgu•Updated 7 months ago
1import { BskyAgent, BlobRef, RichText } from 'npm:@atproto/api';
2
3export async function blueskyPostWithImage(statusText: string, imageBuffer: any, altText: string) {
4 const BSKY_EMAIL = Deno.env.get("BSKY_EMAIL");
5 const BSKY_PWD = Deno.env.get("BSKY_PWD");

GDI_FileUploadmain.tsx3 matches

@all•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [file, setFile] = useState(null);
7 const [fileName, setFileName] = useState("");
131}
132
133function client() {
134 const root = document.getElementById("root");
135 if (root) {
142}
143
144export default async function server(request: Request): Promise<Response> {
145 return new Response(
146 `

GDI_FileUploadmain.tsx3 matches

@rozek•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [file, setFile] = useState(null);
7 const [fileName, setFileName] = useState("");
131}
132
133function client() {
134 const root = document.getElementById("root");
135 if (root) {
142}
143
144export default async function server(request: Request): Promise<Response> {
145 return new Response(
146 `

GDI_FileUploadServicemain.tsx1 match

@rozek•Updated 7 months ago
1export default async function (req: Request): Promise<Response> {
2 if (req.method !== 'POST') {
3 return new Response('Please send a POST request with a file', { status: 405 });

GDI_StatusCodeServicemain.tsx1 match

@rozek•Updated 7 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const path = url.pathname.slice(1); // Remove leading slash

GDI_URLParserServicemain.tsx1 match

@rozek•Updated 7 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const path = url.pathname;

GDI_ServerTimeServicemain.tsx2 matches

@rozek•Updated 7 months ago
1export default async function(req: Request): Promise<Response> {
2 const now = new Date();
3 const hours = now.getHours().toString().padStart(2, "0");
12}
13
14function generateTimeAsciiArt(time: string): string {
15 const digits = {
16 "0": [

GDI_HelloWorldServicemain.tsx1 match

@rozek•Updated 7 months ago
1export default async function (req: Request): Promise<Response> {
2 const asciiArt = `
3 _ _ _ _ __ __ _ _ _

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.