Search
easyAQI
@rishabhparikh
easyAQI Get the Air Quality Index (AQI) for a location via open data sources. It's "easy" because it strings together multiple lower-level APIs to give you a simple interface for AQI. Accepts a location in basically any string format (ie "downtown manhattan") Uses Nominatim to turn that into longitude and latitude Finds the closest sensor to you on OpenAQ Pulls the readings from OpenAQ Calculates the AQI via EPA's NowCAST algorithm Uses EPA's ranking to classify the severity of the score (ie "Unhealthy for Sensitive Groups") It uses blob storage to cache the openai location id for your location string to skip a couple steps for the next time. Example usage @stevekrouse.easyAQI({ location: "brooklyn navy yard" })
// Returns { "aqi": 23.6, "severity": "Good" } Forkable example: val.town/v/stevekrouse.easyAQIExample Also useful for getting alerts when the AQI is unhealthy near you: https://www.val.town/v/stevekrouse.aqi
Script
6. Uses EPA's ranking to classify the severity of the score (ie "Unhealthy for Sensitive Groups")
It uses blob storage to cache the openai location id for your location string to skip a couple steps for the next time.
## Example usage
import { openAqNowcastAQI } from "https://esm.town/v/stevekrouse/openAqNowcastAQI";
const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
export async function easyAQI({ location }: {
location: string;
let openAQLocation = await blob.getJSON(cacheKey(location));
testgolden
@yuanmouren1hao
An interactive, runnable TypeScript val by yuanmouren1hao
Script
export function testgolden(a1, a2) {
return a1 + a2;
![blackhaj avatar](https://images.clerk.dev/oauth_github/img_2TUAkPhP0vwljunt2unlSYul4XW.jpeg)
myApi
@blackhaj
An interactive, runnable TypeScript val by blackhaj
Script
export function myApi(name) {
return "hi " + name;
sharpAmberVulture
@nxtlvlmike
// [Previous code remains the same]
HTTP
// [Previous code remains the same]
export default async function server(request: Request): Promise<Response> {
const css = `
:root {
dailyDadJoke
@jxnblk
Daily Dad Joke How do you make a programmer laugh every morning? A dad joke ~~cron job~~ website! API This val uses the OpenAI API
HTTP
## API
This val uses the [OpenAI API](https://www.val.town/v/std/openai)
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// try changing the prompt to get different responses, e.g. 'Tell me a joke about backend engineers'
const style = "<style>body{font-family:system-ui,sans-serif;margin:0;padding:32px}</style>";
export default async function dailyDadJoke(req: Request): Response {
const openai = new OpenAI();
const resp = await openai.chat.completions.create({
messages: [
dot_com
@vpontis
stevekrouse.com - my personal website This val hosts my personal website. The view data is stored in Val Town SQLite - @std/sqlite. It used to live on Github Pages, which is why I proxy over requests to certain blog posts over to the Github Pages site still. Todos [ ] Speed up page load by loading sqlite data later like in @healeycodes/steve_web [ ] Store more (legally storable) analytics data, and maybe make a sparkline! [ ] Add some sort of way to contact me [ ] Move over all my blog posts from Github Pages (maybe into @std/blob as a CMS?)
HTTP
const dateClass = "text-xs text-gray-400 font-mono mr-1 hidden sm:inline-block";
async function getHits() {
const [, , { rows: [[monthHits]] }, { rows: [[todayHits]] }] = await sqlite.batch([
<span className={dateClass}>2016 Jul -</span>
<Link href="https://medium.com/@stevekrouse/the-trick-to-teach-anonymous-functions-to-11-year-olds-558b697d7a53">
The Trick to Teach Anonymous Functions to 11-Year-Olds
</Link>
myApi
@agibralter
An interactive, runnable TypeScript val by agibralter
Script
export function myApi(name) {
return "hi " + name;
![andyrobinson avatar](https://images.clerk.dev/oauth_github/img_2Rb7DKL5Det7HsanoQ0RGOZJaxX.jpeg)
myApi
@andyrobinson
An interactive, runnable TypeScript val by andyrobinson
Script
export function myApi(name) {
return "hi " + name;
val_qRrZf6Lxcx
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_qRrZf6Lxcx(req) {
try {
// Execute the code directly and capture its result
![parweb avatar](https://images.clerk.dev/oauth_github/img_2RNA5PODNGAhXv9rChgSUwPY7UO.jpeg)
myApi
@parweb
An interactive, runnable TypeScript val by parweb
Script
import { myApi as myApi2 } from "https://esm.town/v/parweb/myApi";
export function myApi(name) {
return myApi2("chris");
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
monacoEditor
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
HTTP
// Initialize Monaco Editor without RequireJS
window.require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.51.0/min/vs' } });
window.require(['vs/editor/editor.main'], function () {
// Define a custom Monokai Light theme
monaco.editor.defineTheme('monokai-light', {
{ token: 'number', foreground: 'ae81ff' },
{ token: 'type', foreground: '66d9ef' }, // Lightened blue
{ token: 'function', foreground: 'a6e22e' }, // Lightened green
colors: {
'editor.background': '#f9f8f5', // Light background for the editor
bot1
@jeffreyyoung
a simple poe bot things to note: don't put underscores (_) in the name, it stops working
HTTP
* Returns a response to the user's query
async function getResponse(req: Query, send: SendEventFn) {
send("meta", { content_type: "text/markdown" });
* Returns your bot's settings
async function getBotSettings(): Promise<BotSettings> {
return {
) => void;
function encodeEvent(event: string, data: any = {}) {
return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
export default async function(req: Request): Promise<Response> {
const reqBody = await req.json().catch((e) => {
![connorads avatar](https://images.clerk.dev/oauth_github/img_2RgxTRDpimmOy6vX6QXfWFOR9sC.png)
myApi
@connorads
An interactive, runnable TypeScript val by connorads
Script
export function myApi(name) {
return "hi " + name;