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?q=function&page=17&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 28949 results for "function"(859ms)

openHeartProtocolGET.tsx1 match

@charmaine•Updated 17 hours ago
1// Receive emojis!
2
3export default async function send() {
4 const urls = [
5 "https://openheart.val.run/charmaineklee.com/OpenHeart",

parquetuser-count-analysis.html1 match

@maxm•Updated 17 hours ago
58 import * as duckdb from "https://esm.sh/@duckdb/duckdb-wasm";
59
60 async function initDuckDB() {
61 try {
62 const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();

parquetuser-analytics-dashboard.html13 matches

@maxm•Updated 17 hours ago
210
211 // Initialize DuckDB
212 async function initDuckDB() {
213 const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
214 const bundle = await duckdb.selectBundle(JSDELIVR_BUNDLES);
238
239 // Initialize the dashboard
240 async function initDashboard() {
241 try {
242 conn = await initDuckDB();
253 document.getElementById("timeRange").addEventListener(
254 "change",
255 function () {
256 timeRange = this.value;
257 currentPage = 1;
263 document.getElementById("tierFilter").addEventListener(
264 "change",
265 function () {
266 tierFilter = this.value;
267 currentPage = 1;
272 document.getElementById("prevPage").addEventListener(
273 "click",
274 function () {
275 if (currentPage > 1) {
276 currentPage--;
282 document.getElementById("nextPage").addEventListener(
283 "click",
284 function () {
285 if (currentPage * pageSize < totalUsers) {
286 currentPage++;
298
299 // Load user table with pagination
300 async function loadUserTable() {
301 try {
302 document.getElementById("tableLoading").style.display =
384
385 // Load user growth chart
386 async function loadUserGrowthChart() {
387 try {
388 document.getElementById("userGrowthLoading").style.display =
518
519 // Load user tiers chart
520 async function loadUserTiersChart() {
521 try {
522 document.getElementById("userTiersLoading").style.display =
591
592 // Load theme preferences chart
593 async function loadThemeChart() {
594 try {
595 document.getElementById("themeLoading").style.display =
663
664 // Load copilot usage chart
665 async function loadCopilotChart() {
666 try {
667 document.getElementById("copilotLoading").style.display =
737
738 // Load referral sources chart
739 async function loadReferralChart() {
740 try {
741 document.getElementById("referralLoading").style.display =
816
817 // Populate tier filter options
818 async function populateTierOptions() {
819 try {
820 const result = await conn.query(`

Teamcontrollers.ts6 matches

@glance•Updated 17 hours ago
10const vt = new ValTown();
11
12export async function getValsForUser(id: string) {
13 try {
14 const vals = await vt.vals.list({ user_id: id });
20}
21
22export async function getDatabasePageIds() {
23 try {
24 const response = await notion.databases.query({
31}
32
33export async function getTeam() {
34 try {
35 const response = await notion.databases.query({
55}
56
57export async function getValTownUser(username: string) {
58 try {
59 return await vt.alias.username.retrieve(username);
63}
64
65export async function getNotionPage(id: string) {
66 try {
67 return await notion.pages.retrieve({
73}
74
75export async function setNotionPage(id: string, data: any) {
76 // bio might be empty (optional field)
77 const bio = data.bio
jsx

jsxdemo.tsx3 matches

@jxnblk•Updated 17 hours ago
3import { renderToString } from "https://esm.sh/react-dom@19/server";
4
5function App () {
6 return (
7 <html>
22 transitionProperty: "background-color, color",
23 transitionDuration: "1s",
24 transitionTimingFunction: "ease-in-out",
25 "&:hover": {
26 backgroundColor: "magenta",
45}
46
47export default async function (req: Request): Promise<Response> {
48 const html = renderToString(<App />);
49 return new Response(html, {
tuna

tunaatomic.tsx2 matches

@jxnblk•Updated 17 hours ago
11const MEDIA_RE = /^@media/;
12
13function createRule(obj, parentKey) {
14 const rules = [];
15 const classNames = [];
54
55
56export function atomic(obj: CSSProperties): TunaResult {
57 const result = new TunaResult();
58 const rules = [];

sqwnietable-info.tsx1 match

@tallesjp•Updated 17 hours ago
20});
21
22function isValidTableName(name: string) {
23 return /^[a-zA-Z0-9_]+$/.test(name);
24}

sqwnienew-file-8718.tsx1 match

@tallesjp•Updated 17 hours ago
1export default async function (e: Email) {
2
3}

ValTownValsdk.ts4 matches

@wolf•Updated 17 hours ago
15 * @returns Promise resolving to whether the project exists
16 */
17export async function valExists(valId: string): Promise<boolean> {
18 try {
19 await sdk.vals.retrieve(valId);
34 * @returns Promise resolving to the Val ID
35 */
36export async function resolveValId(identifier: string): Promise<string> {
37 // If it looks like a direct ID, return as-is
38 if (!identifier.startsWith("@")) {
72 * Determine the type of a Val file.
73 *
74 * This function attempts to determine the type of a file within a val
75 * based on its existing state on the server or its filename. The process...
76 * 1. Check if the file already exists in the Val at the specified path.
94 * @returns The val file type
95 */
96export async function getValItemType(
97 valId: string,
98 branchId: string,

intentionally-errorhi.tsx1 match

@shouser•Updated 17 hours ago
1import { hi } from "https://esm.town/v/valdottown/test-townie-credits/error.tsx";
2export default async function (req: Request): Promise<Response> {
3 return Response.json({ ok: true });
4}
tuna

tuna9 file matches

@jxnblk•Updated 17 hours 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.