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=2463&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 27670 results for "function"(3053ms)

blobmain.tsx9 matches

@natashatherobot•Updated 11 months ago
4
5/**
6 * Provides functions for interacting with your account's blob storage.
7 * Blobs can store any data type (text, JSON, images, etc.) and allow
8 * retrieval across different vals using the same key.
80};
81
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
94}
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
107}
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
123}
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
137}
138
139async function copy(previous: string, next: string) {
140 const res = await get(previous);
141 await set(next, res.body);
142}
143
144async function move(previous: string, next: string) {
145 await copy(previous, next);
146 await delete_(previous);
147}
148
149async function getJSON(key: string) {
150 try {
151 const res = await get(key);
159}
160
161async function setJSON(key: string, value: any) {
162 return set(key, JSON.stringify(value));
163}

dubLinksUpsertmain.tsx1 match

@steventey•Updated 11 months ago
6});
7
8export default async function(req: Request): Promise<Response> {
9 const { shortLink } = await dub.links.upsert({
10 url: "https://www.val.town/v/steventey/dubLinksUpsert",

blobbyFacemain.tsx4 matches

@rupello•Updated 11 months ago
17
18
19async function streamToBuffer(stream) {
20 const chunks = [];
21 const reader = stream.getReader();
32}
33
34async function detectFileType(buffer) {
35 const type = await fileTypeFromBuffer(buffer);
36 // return type ? type.mime : 'unknown';
42
43
44export async function get(key, c) {
45 let result = await blobby.get(key);
46 // console.log('raw result for key:', result, typeof result);
185 newKeyName: '',
186
187 init: async function() {
188 console.log('blobby:', this.blobby);
189 },

sqliteExplorerAppREADME.md1 match

@rupello•Updated 11 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37

staticChessREADME.md1 match

@tmcw•Updated 11 months ago
9Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
10
11Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
12
13Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

blobbyFacemain.tsx4 matches

@natashatherobot•Updated 11 months ago
15console.log("blobbyList:", blobbyList.length);
16
17async function streamToBuffer(stream) {
18 const chunks = [];
19 const reader = stream.getReader();
30}
31
32async function detectFileType(buffer) {
33 const type = await fileTypeFromBuffer(buffer);
34 // return type ? type.mime : 'unknown';
36}
37
38export async function get(key, c) {
39 let result = await blobby.get(key);
40 // console.log('raw result for key:', result, typeof result);
173 newKeyName: '',
174
175 init: async function() {
176 console.log('blobby:', this.blobby);
177 },

resumeHandlermain.tsx1 match

@ajax•Updated 11 months ago
7// import { render } from "npm:@jsonresume/jsonresume-theme-professional@1.0.16";
8
9export default async function resumeHandler(req: Request): Promise<Response> {
10 if (req.method === "GET") {
11 try {

seiveDubbingmain.tsx7 matches

@mux•Updated 11 months ago
43const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
44
45async function verifyMuxAsset(assetId, langs) {
46 if (!assetId) {
47 throw "A Mux asset ID is required.";
76}
77
78function validateLanguages(langs: string[]) {
79 if (!langs) {
80 throw "At least one language is required";
90}
91
92async function createDubbingJob(asset: Mux.Video.Asset, targetLanguages: string[]) {
93 const languageNames = targetLanguages.map(code => {
94 const languageObj = SUPPORTED_LANGUAGES.find(lang => lang.code === code);
99
100 const payload = {
101 function: "sieve/dubbing",
102 inputs: {
103 source_file: {
119}
120
121async function pollDubbingJob(jobId) {
122 const req = await fetch(`https://mango.sievedata.com/v2/jobs/${jobId}`, {
123 headers: {
146}
147
148async function addDubbedAudioTrackToAsset(asset, dubbingJob, langs) {
149 const updates = langs.map(async (lang, index) => {
150 return mux.video.assets.createTrack(asset.id, {
161}
162
163export default async function(req: Request): Promise<Response> {
164 if (req.method !== "POST") {
165 return Response.json({ nope: "we (currently) just POST in these parts " });

mootexmain.tsx1 match

@maxm•Updated 11 months ago
23};
24
25export default async function(req: Request): Promise<Response> {
26 const pageContent = renderToString(
27 <html>

hnResumemain.tsx1 match

@cw12•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3export default async function(interval: Interval) {
4 const ntfyURL = `https://ntfy.sh/${Deno.env.get("NTFY_ID")}`;
5 const hnTopStoriesURL = "https://hacker-news.firebaseio.com/v0/topstories.json";

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.