Show HN: I made a web-based notepad with a built in unit calculator (opens in a new tab)numpad.io
488 pointsHi HN
It also supports percentages, dates and variables.
I've been working on this alone for a few years now, so would love to get some feedback.
Comments (239) 97 threads
One small criticism: In my opinion, no web-based writing app is useful unless the tab key inserts a tab. The default behavior of most browsers to move focus to the next field is tremendously infuriating in this context. Unfortunately, that's what happens here, at least for Firefox.
(Related: key combinations that normally perform cursor movements but which are often used by browser for navigation.)
(ducks) (but srsly)
Continue this thread — 1 reply
First import things you need:
Then create a command: and then add it to the keymap in your extensions array: and then pass the extensions array into where you setup your editor view, eg:Yours looks great. Well done on the release.
Line 100 might have an error though? It isn’t recognising `30th Sept`, does it not like the final `t`?
Well that's pretty neat. I've seen it in fancier setups, but not something Soulver-like. It seems a lot more usable here, since practically any equation can show it.
https://github.com/filipesabella/calcpad
It's electron though, if that's important to you.
You can use the web version, it's all offline and saved in localStorage. Works well in mobile too and can be "installed" as an app from there.
https://filipesabella.com/CalcPad
Continue this thread — 2 replies
There should likely be an explicit override of accessibility so the visitor knows what they're getting into.
Example: I (who am not a programmer) once wrote a tangled mess of HTML and JavaScript to accept, and tabulate data entry for rebar (reinforcing steel) estimates. I was inordinately proud of it, bird's nest of bad programming practice that it was. I could TAB or ENTER-key my way through all fields, the up and down arrows performed the same tasks as the TAB-key, just like on a desktop program.
So why was it important to do things this way, and break the conventions so dear to the heart of the standard's purist? Because this is how I (and many others) estimated rebar in the 1990's:
You sat at a wide desk or table with a set of plans 30" to 48"-wide spread out to your left (if you were lucky) and another 30"-48" of table was needed to catch the plan pages turned to reveal the one you were working on. You right hand rested on the keyboard's ten-key pad some 3-5 feet away. You didn't look at your right hand -- you looked at your left hand index finger which was glued to (and rarely left) the large page at precisely the item you wanted to enter into your tabulation program, as you entered the SAC code, the qty per unit, the number of units, the bar size number, the bend category, the grade of steel, and the total length. Your eyes never left the drawing as you did this, and immediately upon completing that line item, your left hand picked up a yellow highlighter and highlighted that item -- one of many hundreds or thousands that would be necessary in a materials take-off of any appreciable size. To force the use of the TAB-key, or the mouse to move through data-entry fields would simply guarantee that no one would use your program. Ever.
But the purist says, "Someone may stumble." Aunt Loreen said, "Sometimes the 'You shoulds' are the sh-ts."
One related app that I absolutely love is Qalculate![1] (yes, it has a built-in exclamation for default enthusiasm :) )
It can do cool stuff like converting N (newtons) to kg.m/s^2 when you specify units as ?kg. It also converts units like 1kW x 1year = 31.55... GJ
It's fantastic for engineering and specially back-of-envelope calculations. This notepad aspect does seem useful though. One alternative is to use Jupyter notebooks, sometimes I work problems with Sage[2]+Jupyter. Sage is extremely powerful (you can do calculus, linear algebra, and more) but doesn't support units (that I know of), it's more geared toward advanced maths.
[1] https://qalculate.github.io/
[2] https://www.sagemath.org/ It's a bit on the heavy side although it's definitely worth it if you're doing a lot of math. I think the flatpak is preferred due to its significant size.
> 1 metre + 8 chain = 161.9344 m
> 1 tonne + 1 short ton = 1.90718474 t
> 1 tonne + 1 long ton = 2.0160469 t
and give it a pass for not supporting pre 1963 UK | US historic weights and measures .. that's getting into a pretty specific use case where Standards nerds like to have a clear display of what conversion factors are in play and what provenance those factors have.
Time Zone support (on your About ToDo) will be interesting, historic computations with daytime savings support will be a quagmnire :-)
The SHARE DOC URLs seem a bit long - something like "base64 full text of doc as an URL" I guess.
Will this hit a URL length limit if widespread use becomes a thing?
jq play : https://jqplay.org/s/f1r-BZ5xYd2
regex101 : https://regex101.com/r/OqojJl/1
do server side storage and doc hash .. which has issues of its own.
there are so many reference ellipsoids and datums used in different parts of the world at different times .. and then there are the many variations on curved surface to flat map projections to deal with.
But yes - Time and date is an iceberg domain :-)
[1] https://en.wikipedia.org/wiki/Gill_(unit)
> 14 furlongs / 2 weeks in mph [0.0052083333 mph]
Even includes error handling :)
At the bottom you can see some test examples of what it can do. Obviously it is a basic calculator.
But to give you an idea of what that all looks like this is the code for the parser that parses the "as a % of" operator:
[0] https://github.com/bodil/eulalieI wasn't familiar with Eulalie, that's a really interesting approach. I built functionality [0] similar to numpad into a larger record-keeping system, Tap [1]. Precedence rules kindof scramble my brain so I ended up implementing s-expression syntax for Tap formulas.
I ended up writing the parser myself, called sowhat, but used a library for tokenization, moo.js [2]. You can see a demo of just the sowhat editor here [3].
0. https://www.tatatap.com/formulas 1. https://www.tatatap.com 2. https://github.com/no-context/moo 3. https://tatatap-com.github.io/sowhat-editor/
This reminds me of the open source NoteCalc: https://bbodi.github.io/notecalc3/
It was discussed on HN, you might look there for inspiration: https://news.ycombinator.com/item?id=25495393
Continue this thread — 3 replies
All comments shown.
Couldn't load more comments. Check your connection and try again.