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=1725&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 17342 results for "function"(2238ms)

docFeedbackFormREADME.md2 matches

@parkerdavisUpdated 1 year ago
22
23```js
24function updateFeedback(ref) {
25 let feedback = [...document.getElementsByTagName('a')].find(e => e.innerText == 'Feedback')
26 feedback.setAttribute('href', "https://stevekrouse-docfeedbackform.web.val.run/?ref=" + ref)
30```
31
32Finally, you may be wondering why I queue up feedback in `@stevekrouse.docsFeedback`, a private JSON val, and then process it via [`@stevekrouse.formFeedbackAlert`](https://www.val.town/v/stevekrouse.formFeedbackAlert) instead of sending it along to Discord directly in this val. I [tried that originally](https://www.val.town/v/stevekrouse.docFeedbackForm?v=61) but it felt too slow to wait for the API call to Discord before returning the "Thanks for your feedback" message. This is where the `context.waitUntil` method (that Cloudflare workers and Vercel Edge Functions support) would really come in handy – those allow you to return a Response, and then continue to compute. Currently Val Town requires you to stop all compute with the returning of your Response, so the only way to compute afterwards is to queue it up for another val to take over, and that's what I'm doing here.
33
34

migrateREADME.md1 match

@neverstewUpdated 1 year ago
15There will be one migration per val, per version.
16
17You can do anything you want in the function passed to `migrate`; create or alter tables, populate data... whatever!
18
19## Migrating backwards

tursoREADME.md2 matches

@stdUpdated 1 year ago
171. [Generate your keypair](https://www.val.town/embed/new?code=import+%7B+set+%7D+from+%22https%3A%2F%2Fesm.town%2Fv%2Fstd%2Fset%22%3B%0Aimport+%7B+generateKeys+%7D+from+%22https%3A%2F%2Fesm.town%2Fv%2Fstevekrouse%2FgenerateKeys%22%3B%0A%0Alet+keys+%3D+await+generateKeys%28%29%0A%0Aexport+let+exportedKeySetter+%3D+Promise.all%28%5B%0A++set%28%22exportedKeys%22%2C+keys%29%2C%0A++set%28%22publicKey%22%2C+keys.publicKey%29%0A%5D%29)
182. On [your publicKey](https://www.val.town/v/me/publicKey) click the lock icon🔒 to change the permissions to `Unlisted`.
193. [Fork this helper function](https://www.val.town/v/stevekrouse.turso/fork) replacing `stevekrouse` with your own username
204. [Try out some queries!](https://www.val.town/v/stevekrouse.tursoExamples/fork)
21
35## Architecture
36
37This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
38
39Migrated from folder: turso/turso

r2README.md2 matches

@stevekrouseUpdated 1 year ago
12
131. This val requires you to setup public key auth, which is really just three clicks here: https://blog.val.town/public-key-auth-val-town-users-can-be-your-users
142. [Optional] You can setup a helper function so you don't have to pass your keys every time:
15
16```js
18```
19
20Warning: Do **not** make your blob function public or unlisted. That would allow anyone to use it.
21
22## Usage

ntfyREADME.md5 matches

@xkontiUpdated 1 year ago
18```
19
20⚠️ For the notification to be sent it needs to be published (`publish` function).
21
22## Use helper
23
24Executes specified functions that can modify the notification. Can be used to streamline authentication, apply common operations, etc.
25
26```ts
40```
41
42You can pass it multiple functions.
43
44## Functions
45
46### `toServer(url)` - optional
120```
121
122Alternatively you can use dedicated functions: `.withMinPriority()`, `.withLowPriority()`, `.withDefaultPriority()`, `.withHighPriority()`, `.withMaxPriority()`
123
124```ts

docFeedbackFormREADME.md2 matches

@stevekrouseUpdated 1 year ago
22
23```js
24function updateFeedback(ref) {
25 let feedback = [...document.getElementsByTagName('a')].find(e => e.innerText == 'Feedback')
26 feedback.setAttribute('href', "https://stevekrouse-docfeedbackform.web.val.run/?ref=" + ref)
30```
31
32Finally, you may be wondering why I queue up feedback in `@stevekrouse.docsFeedback`, a private JSON val, and then process it via [`@stevekrouse.formFeedbackAlert`](https://www.val.town/v/stevekrouse.formFeedbackAlert) instead of sending it along to Discord directly in this val. I [tried that originally](https://www.val.town/v/stevekrouse.docFeedbackForm?v=61) but it felt too slow to wait for the API call to Discord before returning the "Thanks for your feedback" message. This is where the `context.waitUntil` method (that Cloudflare workers and Vercel Edge Functions support) would really come in handy – those allow you to return a Response, and then continue to compute. Currently Val Town requires you to stop all compute with the returning of your Response, so the only way to compute afterwards is to queue it up for another val to take over, and that's what I'm doing here.
33
34

counterfeitPromptREADME.md1 match

@jdanUpdated 1 year ago
1Migrated from folder: openai_function_calling/counterfeitPrompt

SignatureCheckREADME.md1 match

@karfauUpdated 1 year ago
11```typescript
12const myGithubWebhook = (req: Request) => {
13 const {verify} = @karfau.SignatureCheck(); // you have to call it to get the verify function!
14 const body = await req.text();
15 const signature = req.headers.get("X-Hub-Signature-256");

getWeatherREADME.md1 match

@stevekrouseUpdated 1 year ago
1## Get Weather
2
3Simple function to get weather data from the free [wttr.in](https://wttr.in/:help) service.
4
5```ts

harpersREADME.md2 matches

@visnupUpdated 1 year ago
10```
11
12~/.config/fish/functions/fish_greeting.fish to pick a random line on new fish shell; other shell support left to the reader
13```fish
14function fish_greeting
15 set line (random 1 (cat ~/.motd | wc -l))
16 awk "NR==$line" ~/.motd | fold -s -w (tput cols)

getFileEmail4 file matches

@shouserUpdated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 1 week ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",