Trending Vals
271
272
dthyresson
bedtimeStoryMaker
HTTP
Bedtime Story Maker Inspired from a RedwoodJS demo I mde last year, this adds generative art powered by Fal to the bedtime story maker. Start writing a story by picking a style (spooky, colofrol, adventurous an animal (penguin, mouse, unicorn, whale ...) a color for the animal and activity (befriends aliens, goes to the doctor, rides a rollercoaster, bakes a cake for friends) It uses OpenAI to write a children's bedtime story title summary story for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave". Then using the summary, OpenAI geenrates another prompt to describe the instructions to geneate a childrens story book image. That's sent to Fal to generate an image. Stories get saved to bedtime_stories in SQLite for viewing, searching and maybe sharing. You then get a bedtime story to enjoy!
2
273
g
countGithubLOCUI
HTTP
GitHub Line Counter π GitHub Line Counter , live on val.town ; Ever wondered how many lines of code are in a GitHub repo without the hassle of cloning it? Say hello to GitHub Line Counter β your friendly, web-based LOC inspector! π What It Does This simple tool fetches the GitHub repository as a ZIP file,
decompresses it on the fly (thanks to fflate π¨),
and counts the lines of code β on val.town
with an incredible bandwith and speed. Built with Vanilla JS on the frontend and
powered by val.town on the backend,
itβs lightweight, fast, and ready to use! How to Use Just paste the repo URL, hit "Count Lines," and watch the magic happen! β¨
2
281
andreterron
PSEoutages
Cron
PSE Outage Checker The Pacific Northwest was just hit with a bomb cyclone that caused a huge amount of power outages.
This val tracks the number of outages and impacted customers.
The goal is to graph this data and estimate when will all the outages be resolved. If you know how others can help those affected by the outage, please add a comment here so I can update this readme.
0
282
michaelwschultz
generateframeImage
HTTP
Gathers information and returns an image of this val Why I'm using this val for my 3-color e-ink display run by a Raspberry Pi Zero W. The Pi runs a cron job that tell's it
to fetch this url twice a day and render it to the display. Works like a charm. Right now I'm not displaying much but I'm going to keep iterating on what type of information I want to display. How I'll post more info on my set up here later if you want to try something similar. But I assume this workflow could
be used for lot's of different projects that don't have a ton of compute or where you don't want to learn how to
actually draw things to a screen like all the e-ink display libraries.
1
283
dglazkov
discordBot
Script
A simple Discord Bot scaffolding, a slight rev on the one in the valtown guide . The discordBot function takes in an object where each key is a Discord command and the value is a function to handle the command. If the function returns a Promise , it will be handled as a deferred interaction with a followup message . Usage:
import { discordBot } from "https://esm.town/v/dglazkov/discordBot";
const echo = async (data) => {
await new Promise((r) => setTimeout(r, 5000));
return {
type: 4,
data: {
content: data.data.options[0].value,
},
};
};
export default discordBot({
ping: () => ({
type: 4,
data: {
content: `Pong! It is ${new Date()}`,
},
})
echo,
});
2
284
285
saolsen
tracing
Script
Opentelemetry Tracing for Vals! Enables Opentelemetry tracing for vals.
Exports two functions, init and traced_handler .
init will set up opentelemetry. For how to use it see this example val . By default, traces log to the console but if you set HONEYCOMB_API_KEY it'll also push the traces to honeycomb.
In the future we can add more export targets for other services. I'm also thinking about making a val to display them. traced_handler is a wrapper for your handler you can use on an HTTP val. Just pass it your HTTP function and export it as the default and it'll trace every request. Here's a screenshot of what the honeycomb view of a trace from my connect playing val looks like.
3
287
290
rozek
GDI_AITranslator
HTTP
This val is part of a series of examples to introduce "val.town" in my computer science course at
Stuttgart University of Applied Sciences . The idea is to motivate even first-semester students not to wait but to put their
ideas into practice from the very beginning and implement web apps with
frontend and backend. It contains a simple web page which allows users to enter some german (or other
non-english) text and send it to a preconfigured server. That server translates
the text with the help of OpenAI and sends the result back to this app where it
is finally presented to the user. This val is the companion of https://rozek-gdi_aitranslatorservice.web.val.run/ which contains the server part (aka "backend") for this example. The code was created using Townie - with only a few small manual corrections. This val is licensed under the MIT License.
0
291
292
flesch
altairClient
HTTP
Altair GraphQL Client import { altairClient } from "https://esm.town/v/flesch/altairClient";
import { graphql, GraphQLObjectType, GraphQLSchema, GraphQLString } from "https://esm.sh/graphql";
// Define the GraphQL schema
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: "Query",
fields: {
hello: {
type: GraphQLString,
resolve: () => "Hello from Val Town GraphQL API!",
},
},
}),
});
// Function to handle GraphQL requests
async function handleGraphQLRequest(request: Request): Promise<Response> {
const { query, variables } = await request.json();
const result = await graphql({
schema,
source: query,
variableValues: variables,
});
return new Response(JSON.stringify(result), {
headers: {
"Content-Type": "application/json"
},
});
}
// HTTP handler function
export default altairClient(async function(req: Request): Promise<Response> {
if (req.method === "POST") {
return handleGraphQLRequest(req);
} else {
return new Response("This endpoint only accepts POST requests for GraphQL queries.", { status: 405 });
}
}); β https://www.val.town/v/flesch/graphqlAPIEndpoint
1
295
tmcw
trackIphoneTradein
Cron
Track iPhone trade-in prices iPhone trade in values - to trade phones back to Apple themselves - fluctuate over time , and eventually they no longer accept certain kinds of phones. You can still trade in an iPhone 7 - released in 2016 , about 6 years ago as of this writing. But no longer does an iPhone 6 have value back to Apple. This tracks those values - it runs every month and records prices to iphoneTradeInValues , which I'll visualize once there's some data.
1
298
pomdtr
serve_readme
Script
Serve Readme Usage import codeOnValTown from "https://esm.town/v/andreterron/codeOnValTown?v=50";
import { serveReadme } from "https://esm.town/v/pomdtr/serve_readme";
const val = extractValInfo(import.meta.url);
export default serveReadme({
val,
title: "Code Search is Easy",
}); Example @pomdtr/code_search_is_easy (rendered at https://code-search-is-easy.pomdtr.me )
0
299
300
jdan
dialog
HTTP
dialog Renders windows 98 dialog boxes as SVGs. Using satori and styles from 98.css Usage https://jdan-dialog.web.val.run/? w =200& h =110& title =Hello& caption =World w (default: 200): the width of the dialog h (default: 110): the height of the dialog title (default: "{title}"): the text in the title bar caption (default: "{caption}"): the caption text
3