No description
Find a file
Tiffany Bennett a0ddd52bdb
Rink-web 3 (#165)
Kind of silly that I'm already on the third iteration of the website.
But the previous one was a bit over-engineered and hard to maintain. I
actually can't even get it to compile anymore, it errors out while
trying to build the wasm binary.

So it was either migrate from sapper (which is deprecated and broken) to
svelte-kit (the successor to sapper), or to simplify. I simplified.

The new tech jenga tower is:
- Soupault for building the website
  - AsciiDoctor for the pages
  - cmark-gfm for processing the markdown in the github releases
  - Several plugins and scripts copied from my personal website
- Vite for compiling the javascript
- wasm-pack for building the wasm binary

Rink's website will now be completely static, so operating it is easier.
The javascript and wasm is quarantined to the index page where a rink
repl is active, the other pages are plain html.

The currency fetching is now a totally separate piece of code from the
website. It makes it simpler and requires less code to be loaded during
the regular cron job.

The javascript is way simpler now. It only manipulates the part of the
page that need to be dynamic. It also uses the token format machinery
instead of directly converting rink's output AST to html.

Pros:
- Way lighter, faster page load times.
- Easier to maintain.
- Site contains more information now. An about page, the manual, and a
releases tab with DL links.
- No more URL spam that makes search engines think the site is a content
farm.
- Actually acts as a REPL now so you can run multiple queries, use
`ans`, up/down arrows to re-run previous queries.
- Proper sandboxing - queries that timeout cause the worker to be killed
and restarted.
- Now has a progress indicator on downloading the wasm blob, which is
good on slow connections.

Cons:
- Even more of a custom setup than before.
- It doesn't work offline anymore. At least not until I add a new
service worker, which will be a real pain to debug.
- The interactive parts (the rink REPL) require javascript to work now.
- A lot of the old URLs like `/query/abc` and `/units/meter` are broken.
I think this is fine though. I can add redirects in nginx that point
them to `/?q=abc` and `/?q=meter`.

## Screenshots

### REPL

![image](https://github.com/tiffany352/rink-rs/assets/1254344/7e43fe58-134f-425c-b975-997797fc1af4)

### About page

![image](https://github.com/tiffany352/rink-rs/assets/1254344/d6a34ce5-a357-434c-b7e9-9ddee3884223)
2024-04-20 18:46:50 -07:00
.github/workflows Add --no-fail-fast to coverage build 2022-12-13 18:08:56 -08:00
cli update the help message 2024-04-13 15:45:13 -07:00
core Rink-web 3 (#165) 2024-04-20 18:46:50 -07:00
docs Rink-web 3 (#165) 2024-04-20 18:46:50 -07:00
irc Update dependencies (#89) 2021-04-01 16:13:17 -07:00
rink-js Rink-web 3 (#165) 2024-04-20 18:46:50 -07:00
sandbox Dependencies cleanup (#163) 2024-03-31 14:34:09 -07:00
web Rink-web 3 (#165) 2024-04-20 18:46:50 -07:00
.codecov.yml Add Travis and Codecov configuration 2018-11-15 18:55:45 +01:00
.editorconfig Rink-web 3 (#165) 2024-04-20 18:46:50 -07:00
.gitignore Cache currency data in a file for better reliability 2021-02-14 16:46:17 -08:00
.tokeignore Add tokei ignore file 2022-04-03 21:10:38 -07:00
.travis.yml Fix pattern in kcov invocation 2018-11-20 22:26:35 +01:00
Cargo.lock Rink-web 3 (#165) 2024-04-20 18:46:50 -07:00
Cargo.toml Dependencies cleanup (#163) 2024-03-31 14:34:09 -07:00
LICENSE-GPL Switch to MPL 2016-08-22 10:46:22 -04:00
LICENSE-MPL Switch to MPL 2016-08-22 10:46:22 -04:00
Makefile Better packaging (#158) 2024-03-29 19:15:53 -07:00
PACKAGING.md Dependencies cleanup (#163) 2024-03-31 14:34:09 -07:00
README.md update readme 2024-04-13 16:29:18 -07:00

Rink

codecov crates.io downloads

Rink is an open source unit-aware calculator. It can be used for physics and engineering calculations, as well as dimensionality analysis.

Rink supports most systems of measurements including SI, CGS, natural, international customary, US customary, UK customary, as well as historical measurements. In addition, Rink supports currency conversions.

Features

  • Arbitrary precision math
  • Shows SI physical quantities
  • Finds applicable SI derived units automatically
  • Detailed error messages
  • Helps with dimensionality analysis, such as by offering unit factorizations and finding units for quantities.
  • Temperature conversions

Manual

Describes (hopefully) everything you need to know to use Rink's expression language.

Install

The most common version of Rink is the command line interface rink.

Package Manager Command
Cargo cargo install rink
Pacman pacman -S rink
Nix nix-env -i rink
Scoop scoop install rink

Web Interface: rinkcalc.app

Rink is available via a web interface in addition to the terminal-based interface. Useful for doing calculations on mobile.

Examples

How much does it cost to run my computer each year? Say it uses 100 watts for 4 hours per day, and use the US average electricity cost.

> 0.1545$/kWh * 100W * (4 hours / day) to $/year
approx. 22.57196 USD / tropicalyear

If you made a solid sphere of gold the size of the moon, what would the surface gravity be?

> volume of moon * (19.283 g/cm^3) * G / (radius of moon)^2
approx. 9.365338 meter / second^2 (acceleration)
> ans to gravity
approx. 0.9549987 gravity (acceleration)

Ever heard someone joke about Americans measuring fuel efficiency as rods per hogshead? Let's try with the average US car fuel efficiency.

> 9.4 km/l to mpg
approx. 22.11017 mpg (fuel_efficiency)
> 9.4 km/l to rods per hogshead
approx. 445741.0 rod / ushogshead (fuel_efficiency)

And then you wonder, wait, what even are these units anyway?

> hogshead
Definition: ushogshead = 2 liquidbarrel = approx. 238480942.3 millimeter^3 (volume; m^3)
> liquidbarrel
Definition: liquidbarrel = 31.5 usgallon = approx. 119240471.1 millimeter^3 (volume; m^3)
> rod
Definition: rod = 5.5 yard = 5.0292 meter (length; m)

Library Usage

docs.rs

[dependencies]
rink-core = "0.7"

License

Rink source code is licensed under the Mozilla Public License, version 2. See LICENSE-MPL for details.

The data file definitions.units is licensed under the GNU General Public License, version 3. See LICENSE-GPL for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work will grant the rights lined out in the MPL, including larger works with secondary licenses.

If you plan on making edits to definitions.units, check out the documentation here: docs/rink-defs.5.adoc

Changelog

See here: https://github.com/tiffany352/rink-rs/releases