HNHacker News
TopNewBestAskShowJobs

jQueryIsAwesome

903 karma · joined September 10, 2011

@ivanca at twitter
submissionscomments
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
Maybe 10) You can't directly change the value of 'this'

    this = {};
    ReferenceError: Invalid left-hand side in assignment;
But of course you can make sure 'this' is something you expect it to be.

    if(!this.tagName){
        throw new Error("Only DOM objects can used as 'this'")
    }
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
Bind is not supported in IE8 and older versions. You could use the underscore library or another one that haves a cross-browser bind method.
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
Of course, taking the method out of the object will produce a different result. But if you are doing something weird like that you should know what you are doing.
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
A workaround that I like a little more: http://javascriptisawesome.blogspot.com/2011/11/setinterval-...
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
Yeah it's mentioned in the article, sorry.
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
After assignment "self" does not change even if "this" does.

    var player = { 
        play: function(){
            var self = this;
            setTimeout(function(){
                console.log(self);
            });
        }
    }
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
Maybe "call" and "apply" belongs to that list?

    Function.prototype.call(this, argument0, argument1...)
    Function.prototype.apply(this, [arguments]) // array for args.
In a related note I created a variation of .bind that can have its bounded arguments an 'this' overwritten called mixbind, and also the methods .mixcall and .mixapply that can be used to overwrite arguments too (you can use NULL or undefined to left holes): https://gist.github.com/4303394
jQueryIsAwesome··on JavaScript: Clarifying The Keyword ‘this’
For consistency and to avoid populating the scope with named variables, look at how jQuery works for good examples of how to use 'this' (the puns are infinite with this)
jQueryIsAwesome··on GitHub Says ‘No Thanks’ to Bots — Even if They’re Nice
Good idea; but maybe only the ones with a title and description; to index the ones that have a clear purpose and not some random code without any idea how to use it or what is for.
jQueryIsAwesome··on AppData says that Instagram may have lost 25% of users after TOS change
No.
jQueryIsAwesome··on Show HN: CSS3 animation
Real animation is expensive; and there are many trade-offs for working with such an unstable and cpu-dependent technology. Besides; video and Flash are still "good enough" for most use cases (children animated series, educational videos, etc).
jQueryIsAwesome··on AppData says that Instagram may have lost 25% of users after TOS change
Facebook is like a basic need now, Instagram is more like a hobby with many acceptable alternatives.
jQueryIsAwesome··on Apple's Company Registration for its App Store is Awkward and Awful
Maybe? I just needed an iOS developer certificate. I lack resources to start an international lawsuit against them anyway.
jQueryIsAwesome··on Apple's Company Registration for its App Store is Awkward and Awful
And if you live in a "obscure" country were they don't accept online payments you have to send them a Fax with all your credit card information... yeah, a fax! Even Amazon and Paypal accept online payments with my cc. I guess I am lucky they didn't ask for a telegram. So much for one of the biggest companies in the world.
jQueryIsAwesome··on What happens when you are the doctor on the airplane?
There are lots of epic fails by evolution, is more about quantity than quality so to speak.
jQueryIsAwesome··on I don't want Javascript promises
Is short _and_ incoherent? I must be really bad at writing; here is another attempt at it: http://javascriptisawesome.blogspot.com/2012/12/still-false-...
jQueryIsAwesome··on Are mass shootings really random events? A look at the US numbers
Apples is a clear easily distinguished subset of fruits wish is useful to predict its taste, expiration date, gastric tolerance, etc.

There is many widely different definitions of what a mass-shooting is (about apples we don't); the article is using a definition from the motherjones website; their definition is strict but randomly chosen; like somebody claiming that only red apples are real apples and the other ones are not; with no data to support that this definition creates any useful subset that can or should be statistically analysed; the statistical sample is already biased by absolutist and arbitrary boolean conditionals which render null any conclusion extracted from its statistical analysis (e.g shooter killed 3 people instead of 4 and therefore is not a mass-shooter)

jQueryIsAwesome··on Are mass shootings really random events? A look at the US numbers
I have flagged this article; is not only link bait using the subject everyone is talking about; is being extremely disingenuous using statistics about a so ambiguous concept as "mass shootings" to draw conclusions about a real world situation.
jQueryIsAwesome··on LESS animation library
"I stopped reading after..." is an expression. When someone says "It really breaks my hearth when..." they don't really mean that their cardiac muscles are being damaged. Also, calling someone out for bad language counts as constructive criticism in my book.
jQueryIsAwesome··on Webshell.io
Please add autocomplete, it would make it so much easier to work with; something like the Chrome console.
jQueryIsAwesome··on Your Password Must Be at Least 18770 Characters
Your password must contain at least one unicode character; one space character, one control character, one mathematical notation character, one non-spacing character, one cyrillic character, one tonemic character and remember NOT to use any basic alphanumerical characters ([A-Z0-9]) as those are widely used in brute force attacks and therefore can't be considered safe.
jQueryIsAwesome··on Screenshot-proof images via temporal dithering
The only suggestion I have left is to convert it to a video; that is always difficult to snapshot anyway.
jQueryIsAwesome··on Screenshot-proof images via temporal dithering
Yep, its true. Maybe you should try using an animated gif.
jQueryIsAwesome··on Screenshot-proof images via temporal dithering
This would look way better on actual canvas; right now the demo is just a IMG tag that changes it's z-Index really fast; not an smart way to do it.
jQueryIsAwesome··on Node.js error handling
That way is longer without reason, you must first define in the function scope both variables error and result; the latter only receives assignation when no error has been generated.

    function doAsyncCall(callback){
        var error, result;
        // .. do some async stuff
        // assign error if there was one or result when everything went fine
        if( !error ){ result = data; }
        callback(error, result);
    }
jQueryIsAwesome··on YouTube strips Universal and Sony of 2 billion fake views
And then the owner reupload it again, until you get broke for doing such silly things. And of course the video owner will vlog about it and YouTube will decide that they are just going to decrease the views counter.

This kinds of countermeasures generalizations based on single incidents always struck me as rather silly.

jQueryIsAwesome··on Facebook Will Let People You Don't Know Message Your Inbox For $1
Its not technically mail (is an internal message system) and you don't hold that strict standard for anything else do you?, e.g. all tv commercials are spam because they show unsolicited commercial information, all billboard are spam...
jQueryIsAwesome··on Facebook Will Let People You Don't Know Message Your Inbox For $1
The merchants would still need to use credit cards, so money laundering would not be an issue.
jQueryIsAwesome··on The 2nd Amendment should protect the Internet, not your AK47
Why is intellectually dishonest? Is your view that the 100% of gunshot suicides would have been successfully committed anyway through other mediums? Or they lives don't count because they don't value/want them?
jQueryIsAwesome··on The 2nd Amendment should protect the Internet, not your AK47
Context man, they were recently in a civil war and the communication and transportation was so bad that towns had to be prepared by themselves to affront any possible Britain retaliation; but now with the biggest army in the world, with carriers, combat helicopters and combat jets doesn't seem to have too much sense.
← PreviousPage 6 of 20Next →