|
Dominoes posted:VSCode's complaining about comment sin a `manifest.json` file I'm working on. I just changed my user prefs so that VSCode treats all .json files as “jsonc” (“JSON with comments”); at work we use json as a mix of config and game data, and not having comments for all that sucks. I’ve never seen any parser that cared even a little about comments, even if it is against the spec. It still does have dumb stuff like “no trailing commas ever “, but those at least appear as just warnings.
|
# ? Dec 27, 2019 20:53 |
|
|
# ? May 16, 2024 23:10 |
|
Thanks for that tip on disabling the inspection. The no-trailing-commas things aumsing, in that the default formatter for a diff language I use adds them!
|
# ? Dec 27, 2019 21:05 |
|
Dominoes posted:Thanks for that tip on disabling the inspection. The no-trailing-commas things aumsing, in that the default formatter for a diff language I use adds them! That's because trailing commas is the right thing to do and JSON rarely does the right thing.
|
# ? Dec 27, 2019 21:36 |
|
Thermopyle posted:That's because trailing commas is the right thing to do and JSON rarely does the right thing. I got voted down on this 2 to 1, RIP my git blame.
|
# ? Dec 27, 2019 22:07 |
|
Jaded Burnout posted:I got voted down on this 2 to 1, RIP my git blame. you work with monsters
|
# ? Dec 27, 2019 22:38 |
|
Thermopyle posted:you work with monsters Who hate clean commit diffs
|
# ? Dec 27, 2019 22:55 |
|
Once I looked into how eslint supports comments in their JSON and they just use a package that strips them out first and then handle the resulting JSON normally, so that was exactly what I should have expected.
|
# ? Dec 27, 2019 23:47 |
|
FormatAmerica posted:Who hate clean commit diffs An extra green line you see for three seconds when merging a PR versus a lifetime of maddening, incomplete sentence rear end syntax.
|
# ? Dec 28, 2019 05:44 |
|
I've loving had it with moment. I did what you're never supposed to do and built a (limited scope to what I need it for; don't need to worry about the usual localization/DST pitfalls) Date / DateTime module for a big webapp I have, and in addition to the expected traps being gone, the app is dramatically faster and more responsive. I'm suspicious if I could completely remove it the bundle size would drop, but I'm using a third party Date Picker that relies on it.
|
# ? Dec 28, 2019 06:22 |
|
How many dates were you shown for it to be a dramatic change?
|
# ? Dec 28, 2019 17:13 |
|
I'm _this_ close to initiating a ban on moment at my work. If I can't trust you to use Vuex properly, and you end up with a action chains that take me back to old-timey callback hells, why should I trust your choice to use moment.js? No, Jerry. You don't need the ability to calculate time spans with consideration of Rio de Janeiro summer time in November of 1963, just so the customer can enter their loving birth date. Moment.js is a cancer. If you are not doing something specifically related to tricky time conversions, you should be able to rely on browser localizations. They've gotten pretty good by now. And for the love of all that is good, use UTC when storing it. Don't let the DB do more transformations. You know what they say: when you fiddle with the data, you can only lose information, not add to it.
|
# ? Dec 28, 2019 17:48 |
|
Lazy man's solution to moment issues: Compile a sane datetime library from a sane language to webassembly and use that.
|
# ? Dec 28, 2019 18:49 |
|
Sagacity posted:How many dates were you shown for it to be a dramatic change? Thermopyle posted:Lazy man's solution to moment issues: Compile a sane datetime library from a sane language to webassembly and use that. Dominoes fucked around with this message at 19:24 on Dec 28, 2019 |
# ? Dec 28, 2019 19:19 |
|
fsif posted:An extra green line you see for three seconds when merging a PR versus a lifetime of maddening, incomplete sentence rear end syntax. You're missing the point. it's not about the extra line change during the PR review (though that is annoying), it's that if you have a list of 3 things and add one, you have to change line 3, which means that looking at git blame for line 3 now brings up the useless information that you added line 4, rather than the more useful information of e.g. why line 3 was added or modified in the past. Any syntax you can get used to, but actively making our tools less effective sucks. Also, the whole point of using trailing commas is when you have things on multiple lines for exactly this reason, so "incomplete sentence syntax" is a wacky thing to say since most people, don't write sentences, like this.
|
# ? Dec 28, 2019 19:32 |
|
While I'm chucking spears at Moment, I'm obliged to point out that its string formatting tokens are the nicest I've see, ie compared to the usual `%`. I stole it for the Python wrapper I mentioned.
|
# ? Dec 28, 2019 20:23 |
|
Dominoes posted:A lot. It's a scheduling app. Yeah, chrono is what I had in mind when I made that post. It's pretty good. Go compile it to webass, wrap in some JS, release it to the world, and become super famous. Or maybe complie it to asm.js and then you can put it on NPM. Or maybe you can do that with wasm? I can't really think through it right now.
|
# ? Dec 28, 2019 20:27 |
|
What's wrong with moment now? Is Luxon ok?
|
# ? Dec 28, 2019 21:14 |
|
Thermopyle posted:Yeah, chrono is what I had in mind when I made that post. It's pretty good. The Merkinman posted:What's wrong with moment now? Is Luxon ok? I can't speak to Luxon. Dominoes fucked around with this message at 22:29 on Dec 28, 2019 |
# ? Dec 28, 2019 22:19 |
|
I'm taking a crack at it. Related Q that came up for another reason. Is it possible to make constructor methods besides the default constructor / New()? I seem only able to call methods on instances, and make constructors from standalone fns.
|
# ? Dec 29, 2019 00:08 |
|
The Merkinman posted:What's wrong with moment now? Is Luxon ok? I use this, recommended here by someone before. It works, kind of annoying to inspect a value when debugging is about my only gripe. It is spawned from the Moment team.
|
# ? Dec 29, 2019 00:52 |
|
How can I export functions that aren't active until a promise completes. Ie for the affirmationed WASM wrapper:JavaScript code:
|
# ? Dec 29, 2019 02:10 |
|
The Merkinman posted:What's wrong with moment now? Is Luxon ok? hadn't heard of luxon, but dayjs just works(tm) in my experience.
|
# ? Dec 29, 2019 03:07 |
|
Jaded Burnout posted:You're missing the point. it's not about the extra line change during the PR review (though that is annoying), it's that if you have a list of 3 things and add one, you have to change line 3, which means that looking at git blame for line 3 now brings up the useless information that you added line 4, rather than the more useful information of e.g. why line 3 was added or modified in the past. What do you do if you add new imports from a module and Prettier moves the imports to multiple lines? Your workflow might differ from mine, but I don't spend all that much time comparing past commits. When I do, an added comma has never made my tooling less effective. It's always been pretty easy to infer what's going on.
|
# ? Dec 29, 2019 03:45 |
|
No-one gives a poo poo about auto-organized imports because no-one gives a poo poo about figuring out when or why a particular import was added. Perhaps you can figure out why people might care more about identifying the origin of changes to actual code.
|
# ? Dec 29, 2019 03:59 |
|
I mean a guy that hyphenates "no one" probably isn't going to relate to my particular syntactical preferences.
|
# ? Dec 29, 2019 04:13 |
|
Dominoes posted:How can I export functions that aren't active until a promise completes. Ie for the affirmationed WASM wrapper: This isn't really how promises work. Is the function that's being returned from the promise defined in your codebase? And is it synchronous?
|
# ? Dec 29, 2019 04:18 |
|
The promise starts firing when we load that JS file, and completes when the WASM module is loaded. I can call the WASM functions inside that promise loop, but that precludes wrapping and exporting them. The function being returned in the promise is a Rust function compiled to WASM. Ie, the function being returned is this: Rust code:
Dominoes fucked around with this message at 04:55 on Dec 29, 2019 |
# ? Dec 29, 2019 04:51 |
|
Or use date-fns: https://date-fns.org/ You could also try the new JS API, which is still in active development, but probably still more sane than trying to import the Rust api: https://github.com/tc39/proposal-temporal
|
# ? Dec 29, 2019 07:18 |
|
M31 posted:You could also try the new JS API, which is still in active development, but probably still more sane than trying to import the Rust api: Step 1 can be looked at as converting the module to WASM; easy. Step 2 is wrapping it in a JS module that lets JS users transparently call the WASM as if it were a normal JS module. That's what I'm stuck on. Ie get the code out of the promise and into the global namespace. Here's a SO post describing it; accepted response is that's not how promises work, but there has to be a way around this; the async code here's a side-effect, not the point. It takes on the order of ms to complete. (Subtle distinction that may or may not matter; I want to take functions and classes out of the promise vice a normal value) edit: Got it working with code to this effect: JavaScript code:
Dominoes fucked around with this message at 19:22 on Dec 29, 2019 |
# ? Dec 29, 2019 18:56 |
|
That async loading looks like it's from a dynamic import, does an import statement work?JavaScript code:
Met48 fucked around with this message at 09:30 on Dec 30, 2019 |
# ? Dec 30, 2019 09:14 |
|
That would be fantastic. Here's the error I get when I try using import * as chrono from "../pkg"JavaScript code:
|
# ? Dec 31, 2019 21:15 |
|
The Merkinman posted:Is Luxon ok?
|
# ? Jan 1, 2020 07:26 |
|
I'm looking for an example of a Single Page Application web form that dynamically loads the questions/fields based on what is answered. An example would be a bank loan application where you select what kind of loan you're looking for (mortgage, car loan). Depending on what you answer, additional questions are dynamically loaded in via ajax. I have an idea for a Chrome extension, but I need an example of a SPA web form like the above to build a proof of concept/do testing/research without building one myself.
|
# ? Jan 1, 2020 18:41 |
|
Secx posted:I'm looking for an example of a Single Page Application web form that dynamically loads the questions/fields based on what is answered. An example would be a bank loan application where you select what kind of loan you're looking for (mortgage, car loan). Depending on what you answer, additional questions are dynamically loaded in via ajax. Turbotax maybe?
|
# ? Jan 1, 2020 19:30 |
|
Secx posted:I'm looking for an example of a Single Page Application web form that dynamically loads the questions/fields based on what is answered. An example would be a bank loan application where you select what kind of loan you're looking for (mortgage, car loan). Depending on what you answer, additional questions are dynamically loaded in via ajax.
|
# ? Jan 1, 2020 19:40 |
|
Dominoes posted:From the top of the Luxon homepage: features DateTime, Duration, and Interval types. No, not OK. Needs Date and Time types as well. I'm not sure where you draw the distinction between a Date type and a DateTime type without consideration for time and a Time type and a DateTime type without consideration for date. Seems like you're trying to solve this with wasm and drat any other solution that might be easier.
|
# ? Jan 1, 2020 19:46 |
|
There are many cases for wanting a date with no time data and vice versa. I don't think this is an unpopular or controversial opinion, given most DateTime libraries make the distinction, including the upcoming one for JS posted earlier in this thread. How do I iterate over days without a datetime type? The JS-Date / moment solution appears to be be by iterating through datetimes with time set to midnight, but this is awkward, and in those two libs, is a source of several categories of subtle error. Dominoes fucked around with this message at 21:41 on Jan 1, 2020 |
# ? Jan 1, 2020 21:28 |
|
Dominoes posted:There are many cases for wanting a date with no time data and vice versa. I don't think this is an unpopular or controversial opinion, given most DateTime libraries make the distinction, including the upcoming one for JS posted earlier in this thread. Yeah, dates without time and times without dates are pretty important things to have to accurately model the things people want to model.
|
# ? Jan 1, 2020 21:42 |
|
Dominoes posted:There are many cases for wanting a date with no time data and vice versa. I don't think this is an unpopular or controversial opinion, given most DateTime libraries make the distinction, including the upcoming one for JS posted earlier in this thread. You didn't really answer his question. I can see why "time without date" would be useful for recurring events and so on, but when does having a date with time set to midnight create an issue? Especially since without it, you're going to have no way to accurately handle timezone conversion, unless you eventually end up assuming midnight anyway and you're back to where you started.
|
# ? Jan 1, 2020 22:34 |
|
|
# ? May 16, 2024 23:10 |
|
One example that I most recently encountered is that when you are born is sometimes best represented as a date without a time component. People mostly don't care about what time you were born, and people mostly don't care about converting the date based upon timezones. If you have time and tz info on the date you risk actually converting the date. You could just use a tuple of ints for this but then you can't use functions for adding days/months/years to a date. The problem with using a DateTime when you really want a Date is that you are now using convention rather than types. Thermopyle fucked around with this message at 22:57 on Jan 1, 2020 |
# ? Jan 1, 2020 22:53 |