Hacker Newsnew | past | comments | ask | show | jobs | submit | kennethkl's commentslogin

you don't strike me as someone who reads much, so i can understand why you don't see the usefulness of scroll pan zoom on a computer. specifically on large pdf documents with tiny text. maybe I'm getting old, but those tech spec sheets text feel like they are getting tinier.

also not sure why you'd think ppl wave their hands in front of a touch screen all day blocking their view. most ppl are capable of moving their hands out of the way. it's not clear if you've used a smart phone before, but it's the same. though, i imagine if you did, you'd do as you imagine others do with a touch screen.


you don't need a network lab. this article is not about that. it's not targeting you if you don't have a network lab. feel free to skip it.

but if you have one, this article might interest you.

similarly, an article about having a snail in your aquarium is not about you, needing an aquarium. skip that too if you don't have an aquarium.


to each their own. i personally like direction they took. it's minimal and gives more of a teaser. like a movie poster or game box art. I'd find adding screenshots everywhere is a little too much towards a specific niche detail


i agree -- couldn't bare trying to read, closed tab immediately.


why are all the solutions to for-loop, a different kind of for-loop? aren't you still paying the tax?


The tax the OP is talking about is not the iteration itself, it's the book-keeping required by the form of the `for` loop.

One example: if you want to iterate over the elements of an array `a` of size `n`, the header of the `for` loop will look like this:

    for (i=0; i<n; i++) {
        element = a[i];
        ...
    }
The `i=0` part is related to knowledge that the first element of an array has index zero, and the `i<n` part kind of follows from it -- if `n` is the length of the array, and `0` is the first index, then `n-1` is the last index.

Compare this to

    a.forEach(function (element) { ... })
Here, you don't have to know that the first index is 0 and you can't make the mistake of writing `<=` where `<` would have been correct.

So the "tax" that the OP is talking about is the cognitive overhead of having to know all these things about the array representation, and making sure to get these details right.


Right. Show me the compiled object code and tell me how much faster it is.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."

— Brian W. Kernighan and P. J. Plauger in The Elements of Programming Style.


Well if you're comparing for loop to reduce or map in JavaScript then for will always win as it is a built in language construct and reduce involves costly callbacks. Interesting that the difference is only 7% on my Chrome for Android [0].

[0]: https://jsperf.com/foreach-vs-reduce-vs-for-loop

For loops have also an advantage that they can be used with yield and await (generators and async functions) while you cannot place these keywords inside a callback function.


Regarding your last point, this is also a nice benefit of for...of loops in JS, where you can use yield and await. It's sort of the best of both worlds.


Oh yes, exactly! I wonder why for of was not mentioned in the article...


seems to just change double quotes to single. find and replace. I don't notice any other difference.

oh, noticed `0.5` turn into `.5` and `black` turn into `#000`. not sure how that will make it more JSX compatible


>oh, noticed `0.5` turn into `.5` and `black` turn into `#000`. not sure how that will make it more JSX compatible

That's for minimizing code size. In both of your examples one byte is shaved off.

Arguably this is a case of premature optimization though. For production, the Closure compiler will do a far better job at it. For development, you won't notice the difference of shaving off a few kilobytes.


A Twitter API call without authentication?! I call BS


My guess would be that like-tweet.js is a trash file left over in the repo from someone's testing.

Still this post does illustrate the alarming nature of software dependency hell and how who-knows-what sort of code might easily be slipped into repositories these days.


Or, you know, it's not actually there at all because this is absurdist satire and not meant to be taken literally.


I can't tell satire anymore. It's hard to come up with any more absurd than the real world.


they probably track the closest object to the phone. just a guess. then ignore subsequent echos for a split second.


Your goals sound too large. Start small. Reminds me of a saying my grandmother used to say, when we took walks. "One step in front of the other, over leaves, past trees, and over bridges"

The method I use to get stuff done:

1. Keep in mind an overarching goal; usually something simple and easy to do, but big enough to be a goal. For example, make a humidifier sensor that reports room humidity to a server. 2. Write down small tasks on sticky notes. Very very small. So small, they are easily achievable. 3. Place these sticky notes where you will notice. i.e partly over your monitor. 4. When you've finished a task, throw the stupid sticky in the garbage. 5. Rinse and repeat.

Becomes kinda fun.


I really really like the simplicity and speed of http://nitrous.io. May not look as pretty as the other ones but it's the fastest and extremely functional.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: