245 comments

[ 3.0 ms ] story [ 121 ms ] thread
how do you do

great work, bookmarked.

"Share doc" is not clear imo. Why not "Save & Share"?

This looks really useful for a quick calculation. Thanks for the bookmark!
Nice. Could this be done with a VS Code extension ?
I've never made a VS Code extension, but I think it would be possible; no plans to do so currently though.
there are several inline repl extensions, for many many programming languages. One of the first ones to do it was clojure, imitating the lighttable IDE. I believe you will find similar ones for other languages
Looks nice! Making the result blocks non-text is handy. Any plans to open source this or sell a desktop version? I've long been a fan of http://calca.io but it doesn't run on Linux. There's some other versions out there but they tend to be flaky.
Glad you like it! I've got a desktop version in the works, and if the web version gets enough interest I'll finish it off.
Finish it off sounds like you are going to kill it ;)
Why limit it to arithmetic?

Looks much like the original idea behind lighttable IDE which is basically a REPL plugin that allows to evaluate certain lines within it. There are several similar projects around.

Because Turing completeness scares me!

I was a big fan of Light Table when it first came out and the developers behind it have gone on to do some really interesting things, but I want to keep this project more limited in scope for now.

Coding comes with the implicit responsibility over one’s mess. Everyone understands that hanging your computer for your own actions it’s own’s fault.

That can be an issue if you provide a limitless cloud instance, but you can roll the ball to user’s roof with client a side engine, either JS or a local instance, depending your vision for such an app.

I have a side project slightly similar to the functionality your tool offers focused on expense tracking (or other measures) over time, adding date parsing to the equation in order to plot metrics into a graph and with tags and locations for filtering.
Nice! Can you send a link or is it still in development?
Hey!

It's still in development. I built a proof-of-concept from scratch almost a year ago, which I just open-sourced at the following link.

https://github.com/nonoesp/note-parser

I intend to develop it a bit more and host it online.

A previous prototype, really barebones, is at https://expensed.me.

The idea is to drag and drop (or type) a plain-text note and visualize the data as a scatterplot or other charts.

I'm (slowly) working on something that can eat up PSD2 data from banks and parse it into some usable data, but I'm bad at nicely presenting stuff. It would be great to see your tool and get some inspiration, or maybe even use it.
This sounds super interesting.

I've been thinking of ways to parser phone screenshots with payment data or use bank APIs to add data to my expense tracker, as opposed to adding everything manually, which is the best way I've found for consistency and to make sure everything is properly formatted.

I didn't know about PSD2. Do you have any links or references for me to look at?

Hey, great tool!

Just a little bug: I found that if I click a number to copy, then click it again, I'll get the original string in my clipboard concatenated with " Copied!"

Glad you like it! Thank you for the bug report, I'll get it fixed shortly
I like this! One thing that would be nice is a time zone converter. For example:

8:00pm 24 Aug Toronto time in Dubai time

And have the conversion show up.

Looks very interesting. I think there is some ambiguity with respect to currency symbols, $ converts to USD and £ to GBP. However, depending on user location those symbols can be used to mean very different currencies.
Is there anywhere else that uses "£"? I didn't feel great about having $ default to USD but it is probably what most users want. I'll probably make it location-aware and/or allow the user to decide which it defaults to in the future.
Nice - I'll give it props for:

> 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.

Well, I love this comment. And yes, time zone support terrifies me an order of magnitude more than anything else on the list.
On the gnarly scale dealing with with pre-WGS84 paper maps from about the globe is arguably worse ..

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 :-)

You're right, I'm using lz-string to compress the text before shoving it in the URL. This is definitely a necessary evil for the time being so I don't need a back end component to the app. But eventually I do want prettier URLs and collaborative editing if I can make that work without it bankrupting me or driving me insane.
Be aware URL field in browsers have a maximum number of characters they accept.
For what it's worth, the typescript playground takes the exact same approach as you, placing a compressed (lz-string) copy of the text after the #code/ in a sharing url.
For the next step, maybe you can build an editor/autocomplete with a search-engine in it (you can use an existing search engine).
how expensive was that domain name lol
I'm just paying the standard fee for a .io, it's a far less polluted namespace than .com :)
Very cool!

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

I hadn't seen that before, it's very impressive!
I am the author of NoteCalc, and it warms my heart that my project is mentioned here :)

As a sidenote I would like to mention that NoteCalc is still in active (but slow) development, though I do it privately, and the next big release will be definitely this year.

Just discovered NoteCalc, really cool. Thanks!
When I type `4W*3hours` the result is `12 mWh`. Same with `12Wh/3hours = 4kW`
Oh, thank you for the bug report. I'm not sure why that's happening, but will look into it shortly.
This is great! Love Soulver too, but having it in the browser is fantastic. Well done!
I'm a big fan of Soulver too! It's the OG in this app category and I still use it for calculations NumPad can't do (yet!).
Very cool! Some ideas:

1. Doesn't seem to support area conversions (tried 400 square meters, 400 m^2, and abbreviations in between).

2. If I only give a time, it would be more useful if it gave a time-only result rather than defaulting to the current date - unless it rolls over to a different date. (E.g. in Soulver, "2:30pm + 20hr" gives "Tomorrow at 10:30".)

3. It would be nice to support multiple abbreviations for minutes (mn/min are both used in various countries).

400 inch^2 -> 400 inches² 10 km^2 -> 10 km²

... works for me.

Ohhh, I missed that "->" was the operator. I was typing "to" as in Google searches.

Re dateless times, yes, I think the Soulver way is unambiguous but still human-friendly.

Thanks for the feedback

1. "square" before a unit I probably will implement that in the future. I'm not sure why "400 m^2" isn't working for you, I've just tried it and it works as expected for me?

2. It's a little bit clunky, but I decided to always specify the time and date being shown because there's so much potential for ambiguity. I might revisit this if I can think of a better way of doing it that's still unambiguous (the Soulver way isn't bad tbh)

3. "min" is supported, I've never come across "mn", do you know where it's used?

Love it! This kind of stuff should be added to notepad on Windows (in an opt-in manner)!
IIRC, calc.exe (Windows Calculator) has some (limited) unit conversions built in. Better than nothing in an offline environment...
This is awesome.

Minor bug report -

* 5 feet 8 inches to centimeters -> -171.72 cm

* 5 feet 8 inches to meters -> -0.7272 m

* 5 feet 8 inches to cms -> doesn't work

The conversion seems wrong in the case of cms, and I'm not sure why it's always negative.

"to" is a subtraction operation, not a convert to cue.

As in (distance from) 30 to 50 (is 20 == 50 - 30 )

After reading the sibling comments to mine, I've worked out what it is doing.

> * 5 feet 8 inches to centimeters -> -171.72 cm

As @defrost said, the 'to' operator instructs NumPad to calculate the distance from the unit before 'to' and the unit after 'to'.

To the nearest mm, 5 feet 8 inches = 172.72cm

It appears that NumPad is defaulting to a value of '1' where no value is specified, so it is calcuating the distance BACK from '5 feet 8 inches' TO '1 centimeters'.

It correctly responds with -171.72, which is 1cm less than 172.72.

> * 5 feet 8 inches to meters -> -0.7272 m

Same as above, except the calucation is the distance back from '5 feet 8 inches' TO '1 metres'.*

If you use the operator 'in', NumPad calculates the answer correctly:

5 feet 8 inches in metres -> 1.7272 m

THIS IS AMAZING. the next step is adding variables and assignments and conditionals, and you have something very powerful that can be used by just about anybody to do really interesting things. provided you have a way to integrate with other services that a lot of people use
Variables and assignments are already supported.
should rephrase, meant to say (variables, assignments) AND conditionals
Thanks! Turning the current language into a Turing complete one would be a huge step up in complexity and I'm not sure it will ever make sense to implement. But I have thought about adding the ability for users to define their own functions in JS and might get around to that one day.
I see. despite my not totally unjustified hate of Javascript, Im looking forward to it.
This is awesome! Some feature requests: it would be great though if you could have multiple sessions/tabs in stead of 1. Also a clear button would be nice.
Can’t you just select all then hit backspace? Asking for a friend...
When using it to make simple calculations while on a phone I think it would be easier than the long click select all delete combo, but perhaps this is not really the aim of the tool.
There is something wrong with the order of operations. When I type 2+2*2-6 i get -6 which should be 0.
It looks like APL order? Right-to-left.
No. It’s not right to left. It’s just weird:

  3 ^ 1 * 2   6
  3 ^ 1 / 2   1.73205
  3 ^ 1 + 2   5
  3 ^ 1 - 2   1
I would think this might be the first unit test one would write for a calculator program.
(comment deleted)
Oh there's more:

9 - 3 ^ 2 = 0

9 -3 ^ 2 = 18 ???

pi = 3.1415926536

2 pi = 5.1415926536 ???

sin(3.1415926536 radians) = -0

sin(pi radians) = Incompatible units ???

Seems to assume + if an arithmetic operator is missing?
This is correct, the idea is that you can type things like "6 foot 3 inches" and have it evaluate as an addition. But the example shown above is definitely a problem, I'll try to think of a work around.
I'd think that rule only makes sense after a symbol representing a unit (including potentially 6'3"). Certainly <number> <named constant> should logically assume multiplication.
Yep, this should be evaluated as `(- (+ 2 (* 2 2)) 6)`
(comment deleted)
This is great, I use `bc` a lot at work (particularly when away from desk and my actual calculator) but I'll probably bookmark this to use instead.

One bit of very minor feedback:

`x^y tonnes` errors 'exponent must be unitless'. The more expected (IMO) grouping `(x^y) tonnes` works, so why not have the non-error grouping be the implied one, when no parens given?

I hadn't thought about that before but I think you're right, I've added it to my roadmap.

Getting operator precedence right has been pretty fraught tbh. For example "1km / 3 hours" is evaluated as "(1km) / (3 hours)", but "1 / 3 hours" is evaluated as "(1 / 3) hours", which is odd from a PL perspective, but I think it's more intuitive from a user perspective for this sort of thing.