Better HN
topnewbestaskshowjobs
Log inSign up

jQueryIsAwesome

903 karma · joined Sep 10, 2011 (15y ago) · 690 submissions

@ivanca at twitter
Submissions

comment 13y ago · link · parent

Nope, the shared scope would obligate me to create a function with binded params for each iteration so "i" is not the last value (e.g. path.length) in every call. Examples: http://stackoverflow.com/questions/1451009/javascript-infamo...

comment 13y ago · link · parent

The example I'm talking about is the one where he doesn't handle errors either, this one: http://pastebin.com/98CarwzU.

And your example is disingenuous too, why do we need to add so much logic instead of collecting the errors if you want to handle them anyway?

    result.push(err || data);
So you don't need to copy around a variable called "hasFail", one line can be enough

    var failed = results.every(Buffer.isBuffer);

comment 13y ago · link · parent

... and what does that haves to do with promises?

And in such case you would only do this once outside the listeners of http/or-whatever connections so it would be done just once regardless of the number of concurrent activity.

comment 13y ago · link · parent

All the code and such a big abstraction for the first example when it could have done like this:

    var result = [];
    paths.forEach(function (i, file){
        fs.stat(file, function (err, data){
            result.push(data);
            if (i === 0) {
                // Use stat size
            }
            if (result.length === paths.length) {
                // Use the stats
            }
        });
    });
Fairly understandable, more efficient and without introducing logic patterns foreign to many. It also meet his requirements (It is parallel and we only hit every file once)

comment 13y ago · link · parent

> Only humans perform experiments on other species that we would regard as torture.

Because only humans are capable to, do you seriously think overwhelming cognitive advantage would be used any different if we had different traits? If our heads were shaped like the ones of mice? Or if we had 4 stomachs like the cows? And this selfishness and disregard for other animals well being is what made humans growth so quickly and one of the main reasons you and me exist.

comment 13y ago · link · parent

Fixes done.

comment 13y ago · link · parent

Me too; arrows are just CSS to avoid pixelation.

The code can be found here: https://gist.github.com/AltIvan/5243025

It looks like: http://i.imgur.com/iYrfuOf.png

I know that the login button disappeared but it ask you to login in when you try to reply, up-vote or submit.

comment 13y ago · link · parent

nice; VS too (well, not sure if elegant) using an extension: http://www.hanselman.com/blog/SimultaneousEditingForVisualSt...

comment 13y ago · link · parent

One line of JS would fix this:

    if (/dir=down&/.test(node.href) && !confirm("Confirm downvote:")) return;

comment 13y ago · link · parent

You may break something by breaking it yourself, like naive code: if (window.chrome) console.log("dev forgot to delete this"))

comment 13y ago · link · parent

It's the python plugins and the multiple carets... mostly.

comment 13y ago · link · parent

and what if he stops putting a public reference to the "detector" method?, read previous answer again.

comment 13y ago · link · parent

Not only that, you have to save a reference to the parts of the console that you want to use just in case they attempt to destroy those.

    var c = console
    var l = console.log
    var log = function(){ l.apply(c, arguments) }
Now they can't break the console from working with stuff like:

    console.log = function(){}

comment 13y ago · link · parent

It doesn't matter what your intentions are; eventually it will be used to annoy some developers, lets just hope that it doesn't become something common.

comment 13y ago · link · parent

But what if he starts using setInterval? A more global solution is to: Open the "sources" panel, click on "Event Listener Breakpoints", then click "set Timer" and just delete the lines where it is calling the detector function.

comment 13y ago · link · parent

It does, but you usually don't want to profile other dev's pages; here is another solution that doesn't make profiling unusable:

    chrome.inspector.detector = function(){ return {open:false}}
But a more aggresive solution is this one:

    console = undefined;
    var iframe =     document.body.appendChild(document.createElement("iframe"));
    iframe.style.display = "none";
    window._console = iframe.contentWindow.console
And you can use `_console` instead of `console`

comment 13y ago · link · parent

    console.profile = console.clear = function(){}
That's all you need write in the console to stop this annoyance.

comment 13y ago · link · parent

Require triggered twice the ini file last time I used it (one month ago), I had to add code to check if it has already been executed before. Apparently it haves something to do with jQuery being already loaded before require; also I could not make it work on old browsers despite their claims that it does.

comment 13y ago · link · parent

She probably already knows so is somewhat disrespectful that she has not update the entry saying that Google already fixed her public profile.

comment 13y ago · link · parent

Ok, "personal consumption patterns" now means the authors I want to get updated about. A better analogy would be subscribing to see what an author publishes and subscribing to hear about what everyone is reading; sure, you get a lot of noise but is way more opening and less self-centered. And if you happen to like a lot of authors you get more focus in the ones that are more likely to be of your enjoyment because people like you are working as a quality filter.

comment 13y ago · link · parent

I know the problem, not the solution, but maybe calculating the popularity among the people I follow on twitter (or the ones following the ones I follow in case that dataset is not big enough) to show me a lot less articles for frequent-publisher.

comment 13y ago · link · parent

"Yep. And it never figured out how to handle high-vol and low-vol blogs together in any meaningful way". What I always thought but was never able to articulate so well (hi again fellow twitter user).

comment 13y ago · link · parent

That can become a PITA if you want to preserve events and CSS in the focused element.

comment 13y ago · link · parent

In case you were curious about how they do it: http://i.po.st/static/script/post-copypaste.js

comment 13y ago · link · parent

You are changing the z-index of the "focused" element but you need to check if one of the parents have z-index defined already because in that case the effect doesn't work.

Instead of looking for a workaround I would suggest that since you are already aiming for modern browsers maybe you should use SVG (clip-path) with CSS {pointer-events: none} so you have a real "hole" and you could use 4 dummy divs if you want to disable interaction with non-focused elements.

comment 13y ago · link · parent

Linkbait in its maximum expression... plus "Get our free", is-this-a-link?-game, "Social buttons", "Get our free", "Follow us in timewastter"... now those are some lousy web design trends.

comment 13y ago · link · parent

I invite you to look at the ridiculous amounts of JS lines twitter uses in its interface.

comment 13y ago · link · parent

I don't know OpenOffice but In most programs putting spans around a letter or word does not affect pasting.
12345
23