Avatar

stevekrouse

mayor of val town
Likes
452
stevekrouse avatar
getWeather
@stevekrouse
Script
Forked from sdan/getWeather
linbuxiao avatar
fetchAllUnresolvedJiraIssues
@linbuxiao
Script
An interactive, runnable TypeScript val by linbuxiao
maas avatar
importGists
@maas
Script
Imports Gists to Val Town Import your TypeScript and JavaScript to Val Town Authentication This function requires two keys: one from Github to get your gists, and one from Val Town to make the vals in your account: Github token: https://github.com/settings/tokens Val Town key: https://www.val.town/settings/api Usage You can use this function by calling it and passing your keys like so: @maas.importGists({ githubToken: @me.secrets.githubGists, valTownKey: @me.secrets.valtown, }); Example usage: https://www.val.town/v/maas.untitled_harlequinCrawdad
samwho avatar
notify
@samwho
HTTP (deprecated)
An interactive, runnable TypeScript val by samwho
zackoverflow avatar
lisp
@zackoverflow
Script
Lispaas (lisp as a service) A mini lisp interpreter How to use: To execute code: const result = @zackoverflow.lisp(" (+ 1 2)") To just parse and return the AST: const ast = @zackoverflow.lisp("(+ 1 2)", true) The value returned is the last expression of the program, for example: const lispResult = @zackoverflow.lisp("(+ 1 2) (+ 400 20)") console.log('Val', lispResult.val === 420) Example: Compute Fibonacci sequence let result = @zackoverflow.lisp(` (defun fib (x) (if (<= x 1) x (defun impl (i n-1 n-2) (if (= x i) (+ n-1 n-2) (impl (+ i 1) (+ n-1 n-2) n-1))) (impl 2 1 0))) (assert-eq 0 (fib 0)) (assert-eq 1 (fib 1)) (assert-eq 1 (fib 2)) (assert-eq 2 (fib 3)) (assert-eq 3 (fib 4)) (assert-eq 5 (fib 5)) (assert-eq 8 (fib 6)) (assert-eq 13 (fib 7)) `); Documentation Functions You can define a function like so: (defun hello (x) (print x)) Rest/variadic arguments are also supported (defun variable-amount-of-args (...args) (print args)) (variable-amount-of-args "Hello" "World!") Lists Define a list like so: (let ((my-list (list 1 2 3 4))) (print my-list) (print (list-get my-list 1))) Internally, a list is just a Javascript array. So indexing is O(1), but that does mean cdr requires copying (vs the linked list implementation). Plists Property lists, or records. Internally these are Javascript objects. Create a plist like so: (set null :key "Value") TODO
jdan avatar
lichessDashboard
@jdan
HTTP (deprecated)
A web interface for viewing a bunch of Lichess TV games. https://jdan-lichessDashboard.web.val.run
jdan avatar
lichessGameAscii
@jdan
HTTP (deprecated)
Renders a Lichess game in ascii, with some formatting to show the opponents.
jdan avatar
emojiWeb
@jdan
HTTP (deprecated)
https://jdan-emojiweb.web.val.run/alias/flag_jordan
pomdtr avatar
run
@pomdtr
HTTP (deprecated)
Augmented run api This val is a wrapper on top of the val.town run api, improving it with additional features: basic auth content-type header in response based on url file extension Usage Custom Content-Type The content-type will be inferred from the filename using the mime-types library. If you use a .html extension, the response will be interpreted as text/html ~ $ curl -v 'https://pomdtr-run.web.val.run/pomdtr/helloWorld.html' HTTP/1.1 200 OK ... Content-Type: text/html; charset=utf-8 ... Hello, World! If you switch the extension to .txt , the content-type header switch to text/raw . ~ $ curl -v 'https://pomdtr-run.web.val.run/pomdtr/helloWorld.txt' HTTP/1.1 200 OK ... Content-Type: text/plain; charset=utf-8 ... Hello, World! Passing arguments The request is proxyed to the run api, so you can pass args to your vals via query params or body. See the run api docs for more details. ~ $ curl -X POST -d '{"args": ["pomdtr"]}' 'https://pomdtr-run.web.val.run/pomdtr/helloWorld.html' ... < content-type: text/html; charset=utf-8 ... Hello, pomdtr! Basic Authentication Just add your val town token as the username: curl 'https://<val-token>@pomdtr-run.web.val.run/pomdtr/privateVal.txt'
stevekrouse avatar
xeval
@stevekrouse
HTTP (deprecated)
An interactive, runnable TypeScript val by stevekrouse
pomdtr avatar
prettifyTS
@pomdtr
Script
Prettify Typescript code const pretty = await @pomdtr.prettifyTS("const hello='Hello world'")
pomdtr avatar
valtownOpenAPI
@pomdtr
HTTP (deprecated)
Val Town Typescript Spec This val return an up-to-date typescript version of the val.town openapi spec for usage with a feTS client. Usage Deno script import { createClient, type NormalizeOAS } from "npm:fets"; import openapi from "https://pomdtr-valtownOpenAPI.web.val.run/openapi.ts"; export const client = createClient<NormalizeOAS<typeof openapi>>({ endpoint: openapi.servers[0].url, });
andreterron avatar
createGeneratedVal
@andreterron
Script
Use GPT to generate vals on your account! Describe the val that you need, call this function, and you'll get a new val on your workspace generated by OpenAI's API! First, ensure you have a Val Town API Token , then call @andreterron.createGeneratedVal({...}) like this example : @andreterron.createGeneratedVal({ valTownKey: @me.secrets.vt_token, description: "A val that given a text file position in `{line, col}` and the text contents, returns the index position", }); This will create a val in your workspace, and here's the one created by the example above: https://www.val.town/v/andreterron.getFileIndexPosition
tmcw avatar
valTownApiExampleVal
@tmcw
Script
Val Town API: Find a val by handle and name This val fetches itself via the Val Town API ! Weird, right?
SlugeR avatar
checkRyanair
@SlugeR
Script
An interactive, runnable TypeScript val by SlugeR
jdan avatar
messageBoard
@jdan
HTTP (deprecated)
An interactive, runnable TypeScript val by jdan