Lurker News
Hi 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

Earlier comments
pwdisswordfish02 replies#
The docs say that this is using CodeMirror. The CodeMirror license says that you're allowed to use CodeMirror for your stuff, but that stuff has to in turn include:

1. the copyright notice
2. the text itself that explains that you/others have this permission/obligation
Currently, it looks like NumPad isn't doing either.
From comments here, NumPad is evidently also using decimal.js, which has similar terms.

tonyonodi2 replies#
Both are MIT licensed, I don't think this is the case.
samatman2 replies#
It's true of source code but not artifacts. MIT places no obligation to distribute source, but requires credit and license when someone does so.
tonyonodi1 reply#
Thanks for clearing that up, I'm not distributing the source code so I think I'm good.

Continue this thread — 1 reply

pwdisswordfish08 replies#
> It's true of source code but not artifacts.

That's simply not true. Please don't do stuff like this—to go off and make these kind of proclamations in public. It's negligent at best.

Continue this thread — 8 replies

rpdillon#
Relevant bit of the MIT License:

> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
I think that second part is relevant to the discussion.
https://opensource.org/licenses/MIT

ianbicking#
The About page is also a reasonable place to put credits (whether required or not)
llimllib1 reply#
It would be cool if "6 minutes / 1 mile in min/km" showed `3:44` instead of (in addition to?) `3.7268`

I wrote my own little calculator, much less general than this, to answer running time questions like "to run an 18 minute 5k, what would my mile pace be"? and it would be neat if that were cleanly solvable in a tool like this

tonyonodi#
Yeah, that's a feature I really wanted to get out before my launch deadline but sadly it didn't make the cut. Soon though.
tonyonodi2 replies#
Impressed you found that. I don't have anything set up to automatically update it currently, but I do have an intention to have something set up to automatically update it.
samwillis1 reply#
Ha, yes, I was being nosy. It was quite easy to spot as it's the only XHR/Fetch request.

I was intrigued what you had used to build it, and if you had built your own solver (which you have), and what editor you used (Code Mirror) so went looking at the code. Interesting to see you left the source maps for production, made it easy for my sleuthing...
I experimented with a similar idea last year, but used ProseMirror/TipTap as the editor to enable rich text editing, and the MathJS (https://mathjs.org) solver. I also combined it with PouchDB and Yjs for offline editing and syncing between devices. Never finished it though, you have kept your nice and simple!

tonyonodi#
Oops, didn't realise I'd left source maps in, thanks for pointing it out!

Your project sounds really interesting, I'm following you on twitter now, so tweet about it if you ever finish it and hopefully I'll see.
Having CRDT-based syncing/collaboration is a direction I'd like to take NumPad in eventually, and if I have time. But I definitely think that ignoring that part completely has allowed me to get it to an MVP state.

ewidar1 reply#
Btw the conversions don't seem to work for me:

> 100 eur to usd $-100.63 > 100 usd to eur Incompatible units

mkishi#
The right operator for unit conversions is "in." "to" is used for ranges, so it's doing 100 euros _goes to_ 1 us dollar and giving you back the answer in dollars.

But it seems the parser is breaking when trying to do the inverse, anyway: "100 usd in eur" seems to do "e*ur" and gives "Values must be converted to units."

layer8#
This is really neat, but you need to rethink the date/time/duration arithmetics. You’re equating 12 months with 365.25 days, which gives rise to results like “1 month - 31 days” giving “-0.0184804928 months”. At the same time, “30th January + 1 month” gives “28 Feb 2022 at 12:00:00” (why “2022”, and why “at 12:00:00”? — this is only a date calculation without reference to a year or to a time of day), while “30th January + 30 days” gives “1 Mar 2022 at 12:00:00”, although “1 month in days” gives “30.4375 days”.

In reality, months/years are simply not convertible to days/weeks arithmetically, and you can’t sensibly add months to certain dates, and sometimes also not years (for February 29th). The former should give “Incompatible units”, and the latter should result in something like “Undefined” for incompatible dates.

Load more comments