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=2562&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 28331 results for "function"(4213ms)

semanticSearchTursomain.tsx1 match

@janpaul123โ€ขUpdated 1 year ago
5import OpenAI from "npm:openai";
6
7export default async function semanticSearchPublicVals(query) {
8 const sqlite = createClient({
9 url: "libsql://valsembeddings-jpvaltown.turso.io",

debugValEmbeddingsmain.tsx1 match

@janpaul123โ€ขUpdated 1 year ago
29import { email } from "https://esm.town/v/std/email?v=12";
30
31export default async function(interval: Interval) {
32 const dynamiclandWebsiteHash = await blob.getJSON("dynamiclandWebsiteHash");
33 const newHash = await getHashForUrl("https://dynamicland.org/");

gameIdeaApimain.tsx3 matches

@xkontiโ€ขUpdated 1 year ago
90const ideasKey = "game-ideas";
91
92async function getIdeas(): Promise<Idea[]> {
93 let ideas = await blob.getJSON(ideasKey) as Idea[];
94 if (ideas == null) ideas = [];
96}
97
98async function setIdeas(ideas: Idea[]): Promise<void> {
99 await blob.setJSON(ideasKey, ideas);
100}
101
102function getRandomElement<T>(array: T[]): T {
103 const randomIndex = Math.floor(Math.random() * array.length);
104 return array[randomIndex];

extractHttpEndpointmain.tsx1 match

@xkontiโ€ขUpdated 1 year ago
1export function extractHttpEndpoint(url: string | URL) {
2 const { pathname } = new URL(url);
3 const [author, filename] = pathname.split("/").slice(-2);

formatResumemain.tsx3 matches

@iamseeleyโ€ขUpdated 1 year ago
1export function formatResume(resumeDetails) {
2 function applyFormatting(text) {
3 if (typeof text === 'string') {
4 return text
9 }
10
11 function preprocessResumeDetails(details) {
12 if (Array.isArray(details)) {
13 return details.map(item => preprocessResumeDetails(item));

jadeMacawmain.tsx1 match

@janpaul123โ€ขUpdated 1 year ago
8import OpenAI from "npm:openai";
9
10export default async function semanticSearchPublicVals(query) {
11 const allValsBlobEmbeddingsMeta = (await blob.getJSON("allValsBlobEmbeddingsMeta")) ?? {};
12 const allBatchDataIndexes = _.uniq(Object.values(allValsBlobEmbeddingsMeta).map(item => item.batchDataIndex));

Title_Extractormain.tsx4 matches

@willthereaderโ€ขUpdated 1 year ago
2import { fetch } from "https://esm.town/v/std/fetch";
3
4// Helper function to retrieve CSRF token if needed
5async function getCsrfToken(url, cookies) {
6 try {
7 console.log("Fetching CSRF Token from URL:", url);
36}
37
38// Function to fetch HTML content and extract titles
39async function titleExtractor(url, cookies, csrfToken) {
40 try {
41 console.log("Fetching URL:", url);

indexValsTursomain.tsx2 matches

@janpaul123โ€ขUpdated 1 year ago
6import { truncateMessage } from "npm:openai-tokens";
7
8export default async function(interval: Interval) {
9 const sqlite = createClient({
10 url: "libsql://valsembeddings-jpvaltown.turso.io",
23 );
24
25 function idForVal(val: any): string {
26 return `${val.author_username}!!${val.name}!!${val.version}`;
27 }

bloomingButtonmain.tsx7 matches

@maxmโ€ขUpdated 1 year ago
1let active = false;
2
3function getRandomEmoji() {
4 const emojis = ["๐ŸŒณ", "๐ŸŒณ", "๐ŸŒฒ", "๐ŸŒฟ", "๐ŸŒฑ", "๐ŸŒพ", "๐Ÿ", "๐Ÿ‚", "๐Ÿƒ", "๐ŸŒท", "๐Ÿชป", "๐Ÿ„"];
5 const randomIndex = Math.floor(Math.random() * emojis.length);
7}
8
9function injectCSS(css: string) {
10 const style = document.createElement("style");
11 style.type = "text/css";
33const buttonBackgroundMap = new Map();
34
35// Function to create or get the background div
36function getBackgroundDiv(button) {
37 if (!buttonBackgroundMap.has(button)) {
38 const newDiv = document.createElement("div");
49}
50
51// Function to position the background div behind the button
52function positionDivBehindButton(button) {
53 const rect = button.getBoundingClientRect();
54 const newDiv = getBackgroundDiv(button);
63 window.addEventListener("scroll", () => positionDivBehindButton(button));
64
65 button.addEventListener("click", function() {
66 if (active) return;
67 active = true;

tinygoMandelbrotExampleREADME.md1 match

@stevekrouseโ€ขUpdated 1 year ago
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {
21 return handler(req);
22}

getFileEmail4 file matches

@shouserโ€ขUpdated 1 month 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.