7const dataKey = "caniuse-data";
8
9function Feature({ feature }: any) {
10 const links = feature.links ?? [];
11 return (
27}
28
29export default async function(interval: Interval) {
30 const previousDataUpdatedAt = await blob.getJSON(updatedKey) ?? 0;
31 const previousData = await blob.getJSON(dataKey);
58
59// Render streaming markdown
60export default async function handler(req: Request): Promise<Response> {
61 const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default;
62 return renderMarkdown(stream);
10const stream = await substrate.stream(summary);
11
12export default async function render(req: Request): Promise<Response> {
13 if (new URL(req.url).pathname === "/robots.txt") {
14 return new Response("User-agent: *\nDisallow: /");
3type Handler<T> = (req: Request) => T;
4
5export function http<E>(effect: Handler<Effect.Effect<Response, E>>): Handler<Promise<Response>> {
6 return async req => {
7 const exit = await Effect.runPromiseExit(effect(req));
13}
14
15export function requestJSON<T>(r: Request) {
16 return Effect.tryPromise(() => r.json() as Promise<T>).pipe(
17 Effect.catchAll(() => Effect.fail(`Could not parse Request as JSON`)),
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
11import * as Val from "https://esm.town/v/dvdsgl/val";
12
13export default Val.http(req => Effect.gen(function*(){
14 return Response.json({ ok: true, love: "effect" });
15}));
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "btc");
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
2import { email } from "https://esm.town/v/std/email?v=9";
3
4export async function flowLevels(interval: Interval) {
5 const data = await getFlowLevel();
6 let goodConditions = false;
52}
53
54function getCurrentValue(jsonData: Data, locationKey: string): CurrentValueCorrected | undefined {
55 const location = jsonData.locations[locationKey];
56 const currentLocation = location ? location.current_value : undefined;
61}
62
63async function getData() {
64 const url = "https://minnehahacreek.org/data-json/request/";
65
76}
77
78export async function getFlowLevel() {
79 const data = await getData();
80 const graysBayDamCurrentValue = getCurrentValue(data, "mcwdgraysdischarge");
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.