139 karma · joined Jul 7, 2017 (9y ago) · 41 submissions
3.
Guilty Gear Strive takes 3 minutes to load due to 127 sequential HTTPS requests(reddit.com ↗)
2 points · by Nimelrian · 5y ago · 1 comment
comment 7y ago · link · parent
There's actually an active proposal for a standard library, but it is met with a lot of contempt from the JS community [0]
[0] https://github.com/tc39/proposal-javascript-standard-library...
comment 7y ago · link · parent
Yeah, it was just a parody of the articles The Onion regularly releases regarding another topic and to be honest I didn't quite expect my post to take off the way it did.
I'm also sorry I posted it on Medium, which I personally dislike, but since Medium is frequented by many JS devs it seemed the ideal place to put that joke.
comment 7y ago · link · parent
That is one of the most ridiculous statements I have ever heard.
comment 7y ago · link · parent
Instead of listening directly to the event store for events you have another non-abstracting layer on top and listen to that.
A sensible architecture would have that layer be an abstraction layer for business use cases, so instead of listening to "user-created", "user-edited" and "user-deleted" events and rebuilding the user state in the consumer every time an event is fired, you'd have that layer expose a single user state stream. The rebuilding is handled entirely within the layer.
Many people skip that and just re-expose the "primitive" streams of the event store, because they read "don't expose your persistence layer" and skipped the important ", expose the business state layer instead" which usually comes right after that.
comment 7y ago · link · parent
int main(int argc, char** argv) {
std::vector<std::string> strings{
"apple", "cAt", "cat", "Dog", "apple", "dog", "Cat",
"Apple", "dOg", "banana", "cat", "dog", "apple",
};
strings.erase(
std::remove_if(
std::begin(strings),
std::end(strings),
[seen = std::unordered_set<std::string>{}](std::string_view str) mutable {
std::string lower = "";
std::transform(std::begin(str), std::end(str), std::back_inserter(lower), ::tolower);
if (seen.find(lower) == std::end(seen)) {
seen.insert(lower);
return false;
}
return true;
}
),
std::end(strings)
);
for (auto& str : strings) {
std::cout << str << "\n";
};
}comment 7y ago · link · parent
[1] https://github.com/tc39/proposal-javascript-standard-library...
comment 7y ago · link · parent
Ever tried installing a local package via a file path? NPM just symlinks it into node_modules, causing issues because you suddenly have duplicated dependencies. Yarn does the same, btw.
I have given up any hope regarding npm/yarn acting sensible long ago.
comment 7y ago · link · parent
comment 7y ago · link · parent
comment 7y ago · link · parent
Such a library would only cover features which would be useful in JavaScript in general, not things which are tied to the web platform. (A good heuristic: if something would make sense on a web browser but not in node or on embedded devices or robots, it probably isn't in scope.)
comment 7y ago · link · parent
For example, a function which takes a property path (in the form of an array of strings) and an object as parameters and returns the value at that path inside the object still needs overloads for every single tuple length.
type Key = string | number | symbol;
function get<T, K extends keyof T>(path: [K], obj: T): T[K];
function get<T, K1 extends keyof T, K2 extends keyof T[K1]>(path: [K1, K2], obj: T): T[K1][K2];
function get<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(path: [K1, K2, K3], obj: T): T[K1][K2][K3];
function get<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(path: [K1, K2, K3, K4], obj: T): T[K1][K2][K3][K4];
function get(path: Key[], obj: any) {
if (path.length === 0) {
return obj;
}
const key = path[0] as Key;
const rest = path.slice(1) as [Key];
return get(rest, obj[key]);
}
interface Foo {
foo: {
bar: {
baz: {
val: number;
}
}
}
}
declare const foo: Foo;
const num = get(["foo", "bar", "baz", "val"], foo);
In this case, num is implicitly typed as number, but if the path would be longer, you'd need to add more overloads.comment 7y ago · link · parent
Are there any news regarding new, more environment friendly mining processes?
[1] https://www.wired.co.uk/article/lithium-batteries-environmen...
comment 7y ago · link · parent
Just because they may be overused in Java doesn't mean people shouldn't use them at all in other languages.
comment 8y ago · link · parent
comment 8y ago · link · parent
> It was shown that wait times are required in the order 50–100 years for the remote handling recycling option and hundreds (Li4SiO4) to thousands (Eurofer) years for hands-on handling.
comment 8y ago · link · parent
"Embrace, extend, extinguish" was one of Microsoft's key strategies.
https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis...