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=2614&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 29175 results for "function"(2060ms)

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";

helloWorldREADME.md3 matches

@jollytoad•Updated 11 months ago
1Hello world server, using [http functions](https://jsr.io/@http).
2
3Try hitting URLs such as: [/world](https://jollytoad-helloworld.web.val.run/world), [/world.txt](https://jollytoad-helloworld.web.val.run/world.txt), [/world.json](https://jollytoad-helloworld.web.val.run/world.json), [/world.html](https://jollytoad-helloworld.web.val.run/world.html), or even [/\<script>.html](https://jollytoad-helloworld.web.val.run/<script>.html).
4
5This demonstrates how you can import and compose simple functions to construct a router to route based on various aspects of a request, ie. the URL path, method, and even on media-types based on path extension or the `Accept` header.
6
7See [routing functions](https://jsr.io/@http/route), and [response helpers](https://jsr.io/@http/response) on JSR.
8
9For a more detailed guide on building a Deno app, including things like fs based routing, with these fns see... https://jollytoad.deno.dev/blog/http_getting_started

sendSMSmain.tsx2 matches

@nmsilva•Updated 11 months ago
24};
25
26export async function sendSMS(phoneNumber: string, message: string, carrier: string): Promise<void> {
27 const carrierDomain = carriers[carrier.toLowerCase()];
28 if (!carrierDomain) {
34 console.log(`Attempting to send SMS to: ${to.email}`);
35 const result = await sendEmail(to.email, "SMS", message);
36 console.log("Email function returned:", result);
37 console.log("SMS sent successfully");
38 } catch (error) {

Breathemain.tsx6 matches

@jeremys•Updated 11 months ago
1export default async function(req: Request): Promise<Response> {
2 const query = new URL(req.url).searchParams;
3
143 let timerId;
144
145 function startBreathing() {
146 const totalDuration = parseInt(timerElement.value) + parseInt(holdTimerElement.value);
147 innerCircle.style.animation = \`breathe \${totalDuration}s infinite\`;
150 breathText.textContent = 'Inhale';
151
152 function breatheCycle() {
153 breathText.textContent = 'Inhale';
154 timerId = setTimeout(() => {
172 }
173
174 function stopBreathing() {
175 innerCircle.style.animation = 'none';
176 resetButton.style.display = "none";
186 holdTimerElement.addEventListener('input', updateHoldTimerValue);
187
188 function updateTimerValue() {
189 document.getElementById('timerValue').textContent = timerElement.value;
190 if (innerCircle.style.animationPlayState === 'running') {
194 }
195
196 function updateHoldTimerValue() {
197 document.getElementById('holdTimerValue').textContent = holdTimerElement.value;
198 if (innerCircle.style.animationPlayState === 'running') {
tuna

tuna9 file matches

@jxnblk•Updated 1 day 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.