Avatar

stevekrouse

mayor of val town
Likes
452
jdan avatar
writeMessage
@jdan
Express
An interactive, runnable TypeScript val by jdan
stevekrouse avatar
dlock
@stevekrouse
Script
dlock - free distributed lock as a service https://dlock.univalent.net/ Usage API Acquire a lock. The id path segment is the lock ID - choose your own. https://dlock.univalent.net/lock/arbitrary-string/acquire?ttl=60 {"lease":1,"deadline":1655572186} Another attempt to acquire the same lock within its TTL will fail with HTTP status code 409. https://dlock.univalent.net/lock/01899dc0-2742-44f9-9c7b-01830851b299/acquire?ttl=60 {"error":"lock is acquired by another client","deadline":1655572186} The previous lock can be renewed with its lease number, like a heartbeat https://dlock.univalent.net/lock/01899dc0-2742-44f9-9c7b-01830851b299/acquire?ttl=60&lease=1 {"lease":1,"deadline":1655572824} Release a lock https://dlock.univalent.net/lock/01899dc0-2742-44f9-9c7b-01830851b299/release?lease=42
naquiroz avatar
slackReplyToMessage
@naquiroz
Script
An interactive, runnable TypeScript val by naquiroz
frontsideair avatar
exchangeRate
@frontsideair
Script
An interactive, runnable TypeScript val by frontsideair
stevekrouse avatar
hiNicoFromGists
@stevekrouse
Script
Import from Github Gists You can import from Github Gist's raw URL: await import("https://gist.githubusercontent.com/...") This example pulls from this gist: example.js Which has this code: export const hi = function() { return "Hi Nico!" }
stevekrouse avatar
valtownAPIExamples
@stevekrouse
Script
An interactive, runnable TypeScript val by stevekrouse
tmcw avatar
todo_list
@tmcw
Express
TODO List Every web project needs a todo list, right? This is val.town's first (maybe?) With a healthy dose of htmx and web fundamentals, we're packing the essentials of a TODO list with server persistence and animations into about 60 lines. The data is stored in the @tmcw.todos val, for now. Try it out.
pomdtr avatar
telegram
@pomdtr
Script
Send yourself a Telegram message Inspired by console.email , this val lets you send yourself a Telegram message via the valtown_bot from any of your vals @me.telegram("hi to me on telegram!") Installation 1. Start a conversation with valtown_bot Click here: https://t.me/valtown_bot 2. Copy your Secret 3. Save in your secrets under telegramSecret 4. Fork this val & run it Save your own private version of a telegram function to your account by forking this val: https://www.val.town/v/pomdtr.telegram 5. Send a test message! await @me.telegram("hi to me on telegram!") PS: the bot code is available here
stevekrouse avatar
telegram
@stevekrouse
Script
Forked from pomdtr/telegram
hootz avatar
telegramDalleBot
@hootz
Script
Telegram DALLE Bot A personal telegram bot you can message to create images with OpenAI's DALLE ✨ Set up yours fork this val speak to telegram’s https://t.me/botfather to create a bot and obtain a bot token set the bot token as a val town secret called telegramDalleBotToken add a random string as a val town secret called telegramDalleBotWebhookSecret set up your webhook with telegram like this: // paste and run this in your workspace on here @vtdocs.telegramSetWebhook(@me.secrets.telegramDalleBotToken, { url: /* your fork's express endpoint (click the three dots on a val) */, allowed_updates: ["message"], secret_token: @me.secrets.telegramDalleBotWebhookSecret, }); message your bot some prompts! (if you get stuck, you can refer to the telegram echo bot guide from docs.val.town)
stevekrouse avatar
svgAnimation
@stevekrouse
Express
SVG Animation Source: https://simpatico.io/svg.md#nativesvganimation
stevekrouse avatar
today
@stevekrouse
Script
Today's Date Returns today's date without timestamp. Usage @stevekrouse.today() // "10/07/2023"
byjp avatar
atproto
@byjp
Script
A quick method to derive the ATProto PLC from a domain using Cloudflare's 1.1.1.1 service. Use as an API with val.town's usual URL structure: eg. https://api.val.town/v1/run/byjp.atproto?args=%5B%22byjp.me%22%5D
vtdocs avatar
guestbookExample
@vtdocs
Script
Guestbook Example See @vtdocs.guestbook to set up your own interactive guestbook. This is an example for testing!
vtdocs avatar
guestbook
@vtdocs
Script
Guestbook You can put an interactive guestbook on your website using vals! This val is the backend of the guestbook that returns existing messages and handles new messages. To generate a HTML snippet to post on your website, use @vtdocs.generateGuestbookSnippet . Setup Fork this val. Paste the below snippet into your Val Town workspace – replacing alice and guestbook with your Val Town username and the name of @vtdocs.guestbook fork respectively. @vtdocs.generateGuestbookSnippet('alice', 'guestbook') Place the HTML block it returns anywhere on your website.
byjp avatar
addShortlink
@byjp
Express
Shortlinks for the decentralised web This is a script to allow API-based updating of the shortlinks/redirects in an IPFS-based shortlink repo (using val.town). I've written up how all this works on my blog at https://byjp.me/posts/link-shortener