Awesome
📈 rig (redbean-interactive-grapher) ⧐
(This proof-of-concept was intended for single-use but it is made public here in case others might be interested!)
made with readbean 1.0 | redbean-1.0.com | redbean-1.0.com.dbg |
The code here is NOT intended to be an example of best-practice in Javascript, Lua or the use of αcτµαlly pδrταblε εxεcµταblεs and redbean. It uses garish colours specifically because the intent is for others to make modifications! All of the source code is to be found within index.html - no external CSS or Javascript, no Javascript framework even though I itched to find an excuse to use Hyperapp. This was really an opportunity to play with what an ape webapp means!
SQLite in the browser comes thanks to SQL.js. Code highlighting thanks to Prism and Yace.
This is a poorly accessible web application, if anyone is interested in better access please reach out - I'm super happy to help.
Install
- Download the latest rig.com ape
- Make
rig.com
executable according to your platform - Run it (a new browser window should open to http://localhost:8080)
To be sure the story involves trusting that this executable will do nothing untoward. If you on are a Mac you will need to explicitly verify that you are okay with execution by visiting
System Preferences
|General
and pressing theAllow Anyway
button next to the message about rig.com coming from the untamed wilds.
Usage
🟠 The SQL
(in orange!) pane accepts queries against the in-memory DB. CTRL-Enter
executes these.
🟢 Up to 10 rows of results represented in JSON appear in the Data
pane (in green!) including a tiny actual row count.
🟣 The Javascript
pane (in purple!) accepts JS and again executes when CTRL-Enter
is pressed. To automate code execution whenever a SQL query is executed, check the checkbox!
Loading files is available using the ⇱ button in the top left-hand corner, and saving is available with the ⇲ button in the top right-hand corner of the screen. Remote files can be loaded by pasting a URL.
Notes
- In queries we avoid joining to the location table for improved speed since this table is really just a static lookup table for location names and information. Using it in a legend for the graph may be sensible.