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
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
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
1Migrated from folder: openai_function_calling/counterfeitPrompt
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");
1## Get Weather
2
3Simple function to get weather data from the free [wttr.in](https://wttr.in/:help) service.
4
5```ts
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)
1# Get the day of week name
2
3JavaScript's [`Date.prototype.getDay()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay) returns a number that represents the day of the week, `0` for Sunday, `1` for Monday, etc. This function returns the name of the week, ie `"Sunday"`, `"Monday"`, etc.
4
5The function optionally inputs a `Date` object, but will default to the current time if none is provided.
6
7Migrated from folder: Archive/getDayName
2(Ignores any untitled vals, since those are sometimes created as an execution context.)
3
4By passing a function as the first argument you receive all references as arguments, and can pick or transform them, e.g.
5- [@karfau.refToValUrl](https://val.town/v/karfau.refToValUrl)
6
2Deletes a specific val.
3
4Pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: docs/api/deleteValExample
A helper function to build a file's email
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.