Is there any Promise.all alternatives? let's says i have list of chan '(c1, c2, c3) and i want to wait all of them to be resolved before i do operation to the list
is there any way to define regexes in clojurescript without using the string format?
You mean, you want to avoid using #"..."
and (re-pattern "...")
?
I want to avoid having to use escape characters
this is the javascript regex I want to use /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Right. I hope I'm wrong but I'm pretty sure that's impossible.
Well, at least I know. The bigger problem is that I am unable to transcribe it to clojurescript it seems. Need to rebuild it from ground up :-<
it's not as bad as it could be, I just don't want to cook up my own email regex
You probably should use a library for that. A JS one, likely. Emails are notoriously hard to get right.
Yep, that regex fails on e.g. Abc@def@example.com
.
Some other examples are here: https://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/
"Note there is no perfect email regex" - yeah, that's what I don't like about all that. :)
correct way would be "Abc@def"@example.com
which passes this
Hmm, maybe. In this case, that article is wrong. TBH I didn't really delve into the RFC, but I remember distinctly battling with quite a few regexes to get some emails right.
Same here, so I am not arguing, just presenting my own anchors to the topic 🙂
If I were to start parsing email addresses from the ground up, I would probably generate the parser straight from the grammar defined in the RFC. No regexes allowed. :)
you know, RFC is request for comments, not a standard, it really doesn't solve the problem
there are more than one, I believe, and not everyone adheres to it. The backend people - not me - have to decide what email formats they let in the database. But then, they use Django ORM with something pre-baked, that I couldn't find it was coming from postgres or anything, so this regex is my attempt to move them into action, since if they have to support something like this, that is probably worse than anything they come up with by themselves
> RFC is request for comments, not a standard That's a very good point. I keep glancing over what "RFC" stands for. > there are more than one, I believe Oh, I've never heard about alternatives. Do you have any links?
> they use Django ORM with something pre-baked Ah, I would then immediately assume that it does something absolutely wrong. When it comes to Django, such reasoning has never failed me.
https://tools.ietf.org/html/rfc196, https://tools.ietf.org/html/rfc772, https://tools.ietf.org/html/rfc821, https://tools.ietf.org/html/rfc822, https://tools.ietf.org/html/rfc2821, https://tools.ietf.org/html/rfc2822, https://tools.ietf.org/html/rfc5321, https://tools.ietf.org/html/rfc5322 😄
Well, we are just building several financial products with old django, so it's all fine
As to why that RegEx above doesn't work with CLJS.
To convert it to a properly escaped string: JSON.stringify(/.../.source)
.
And then replace the [a-zA-Z\-0-9]
part with [a-zA-Z0-9-]
. Not sure why CLJS doesn't like -
in the middle.
Thanks, I will try it. Right now I am just trying to boot up my dev env. For half an hour now. The joys of development that apparently evades everyone but me.
Not really, but usually it doesn't happen once you set it up properly. O(1), so not many are vocal about it.
But that's unreasonable.
i have 3 or 4 machine setups every year. Every language + every editor it's own problem.
it happens dozens of time yearly
"3 or 4 machine setups every year" doesn't sound like your regular Joe's workflow. Same for "every language + every editor" - except for a few corner cases, I always use the same combinations.
Out of interest - why do you have to do 3 or 4 machine setups every year?
I don't "have to", it just happened that way.
Like, this last one was because I needed a machine with a GPU.
Time to write some scripts I guess. :) Quite a few people do that to make any new setup as painless as possible. I don't do that - I change machines once every few years, so it's not a big deal for me.
Right, because scripts will not add complexity but reduce it. I like how that goes. Tell me which scripting should I use. I want to to work for macos, win10 and linux only
no arm64 yet
😄
I can't even use a single editor for all the languages I need to write.
Well, I'm afraid I'm out of suggestions for those kinds of Swiss knives. :) Except for some meta-measures, like simply avoiding doing work that requires a bazillion of setups. But those are obvious.
and now we have backend validation for emails 😄
@raefaldhiamartya I only know of p/all
from promesa: https://github.com/funcool/promesa
How do you provide environment specific configuration to a Clojurescript app?
If you're using shadow-cljs: https://shadow-cljs.github.io/docs/UsersGuide.html#shadow-env
exactly what I'm looking for! Not using shadow-cljs though, do you know anything similar for figwheel?
Nope, you'd have to search its documentation for that. I stopped using it years ago.