7,416 karma · joined Oct 23, 2009 (17y ago) · 1,582 submissions
Email: charles@codemix.com
comment 4y ago · link · parent
comment 4y ago · link · parent
It is possible to write very fast js, but it's hard to write very fast idiomatic js
comment 4y ago · link · parent
function isValidInput(input: unknown): input is "RED" | "GREEN" {
return input === "RED" || input === "GREEN";
}
const input = readFromUser();
if (isValidInput(input)) {
doTheThing(input); // no type error
}comment 4y ago · link · parent
comment 4y ago · link · parent
317.
Deprank: Use PageRank to find the most important files in your codebase(github.com ↗)
164 points · by phpnode · 4y ago · 43 comments
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
I don't think the idea is really that bad, and a form-filling browser extension would not be comparable to what they were trying to do here. The idea is pretty compelling in isolation - your random mom n pop ecommerce site can compete with Amazon on price for a lot of things, but it can't compete with convenience.
If I go to Amazon I can buy something with one or two clicks and be pretty certain that my card details aren't going to get stolen and the thing I ordered will probably arrive when they say it will just about.
If I go to a random ecommerce site I probably have to register, have to enter my card details and confront the possibility of getting ripped off. It's so much less convenient, so for most purchases I just go to Amazon, which is bad for a bunch of reasons.
What Fast was promising to do was to bring that convenience and trust to ecommerce sites, so that they could become more competitive with the Amazons of this world, get more sales, make more money, consumers save money, everyone wins.
Of course the problem is that they're only compelling when they're ubiquitous, and when everyone already has an account and everyone already trusts them. It's a bootstrapping problem, one that only really works if you burn a whole bunch of capital to get both consumers and suppliers signed up, or if you can piggyback off someone else's market penetration, e.g. Stripe, and even with that leg-up they weren't able to survive. All of this also ignores the existence of paypal, apple pay, google pay etc which do offer most of the convenience already.
comment 4y ago · link · parent
$$('span.commtext').forEach(span => {
const frag = document.createDocumentFragment();
span.textContent.split(/\s+/).forEach(word => {
const len = Math.ceil(word.length * 0.3);
const leading = document.createElement('strong');
leading.textContent = word.slice(0, len);
const trailing = document.createTextNode(word.slice(len) + ' ');
frag.appendChild(leading);
frag.appendChild(trailing);
});
span.parentNode.replaceChild(frag, span);
})comment 4y ago · link · parent
comment 4y ago · link · parent
The real reason that microservices are so prevalent is that they became fashionable, for exactly the same reason a particular item or brand of clothing becomes fashionable - influential people were seen using them and so regular people aspired to start using them too. At a certain point in the popularity curve, _not_ using microservices becomes a controversial viewpoint.
They also suffer from being what I call "conceptual crack". There is a certain kind of idea that really tickles some kinds of engineer's brains. Microservices seem like a such a clean solution, each service having its own single responsibility, so easy to draw on a whiteboard, so neat and tidy. Other ideas I place in this category are blockchain, redux, and V=f(s). Clean and tidy ideas that are compelling conceptually but result in nightmarish levels of hidden complexity when they're put into practice.