Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');| CREATE TABLE accounts( | |
| id serial PRIMARY KEY, | |
| name VARCHAR(256) NOT NULL | |
| ); | |
| CREATE TABLE entries( | |
| id serial PRIMARY KEY, | |
| description VARCHAR(1024) NOT NULL, | |
| amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
| -- Every entry is a credit to one account... |
| <!DOCTYPE html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>d3 depth chart</title> | |
| <script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script> | |
| <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script> | |
| <style> |
| select json_build_object('__table', 'user', 'firstName', e."first_name", 'lastName', e."last_name", 'managedResources', coalesce("t_managedResources"."data", '[]'), 'ratings', coalesce("t_ratings"."data", '[]')) as "data" | |
| from "user" as "e" | |
| left join ( | |
| select "manager_id" as "fkey", json_agg(json_build_object('__table', 'resource', 'ratingTotals', "t_ratingTotals"."data")) as "data" | |
| from "resource" as "e" | |
| left join ( | |
| select "resource_id" as "fkey", json_build_object('__table', 'rating_totals', 'avgSatisfaction', e."avg_satisfaction") as "data" | |
| from "rating_totals" as "e" | |
| ) as "t_ratingTotals" on "t_ratingTotals"."fkey" = "e"."id" | |
| group by "manager_id" |
| /** | |
| * Cloudflare Worker for Server-Sent Events (SSE) | |
| * | |
| * This worker demonstrates how to set up an SSE endpoint | |
| * that sends an initial message and then periodic updates. | |
| */ | |
| // Listen for incoming requests | |
| addEventListener('fetch', event => { | |
| event.respondWith(handleRequest(event.request)); |