Profile cover photo
Profile photo
James Allardice
62 followers -
Enthusiastic senior JavaScript developer and big fan of jQuery.
Enthusiastic senior JavaScript developer and big fan of jQuery.

62 followers
About
Posts

Post has attachment
What is the purpose of the "Confusing regular expression" warning? I'm attempting to write a page on it for http://jslinterrors.com but struggling to understand its purpose.

It appears to be raised when JSLint encounters a regexp literal, immediately followed (no whitespace) by a / or * character, neither of which is a valid flag, and neither of which is much use in that situation as the operator it will be interpreted as:

    var r1 = /^example$//;        // Raises warning, syntax error
    var r2 = /^example$// 5;    // Raises warning, r2 is NaN 
    var r3 = /^example$/ / 5;   // Does not raise warning, r3 is NaN

Am I missing something obvious?

Post has attachment

Post has attachment
Introducing Grunt Montage, a Grunt plugin for generating CSS sprites and their associated stylesheets: https://github.com/globaldev/grunt-montage
Add a comment...

Post has attachment
I recently gave a short introductory talk on AngularJS at +Global Personals. The interactive slides are now available on GitHub: http://jamesallardice.github.io/talks/angular-intro
Add a comment...

Post has attachment
Add a comment...

Post has attachment
Add a comment...

Post has attachment
It appears that +JSHint version 1.1.0 has introduced a (currently undocumented) change to the way the `unused` option works. In version 1.0.0 and below, the option could receive the usual `true` or `false` values. As of 1.1.0, it is now able to receive one of three new values:

"vars" - will warn about unused variable/function declarations
"last-param" - the same as "vars", plus warnings about the final argument of functions
"strict" - the same as "last-param", plus warnings about all arguments of functions

See this Stack Overflow question and answer for a bit more detail.
Add a comment...

Post has attachment
I've written an article about the Chrome for iOS bug I discovered while writing an entry to JS1k 2013. Be careful if you're running minified JavaScript some time after page load! http://jamesallardice.com/chrome-on-ios-might-eat-your-global-variable/
Add a comment...

Post has attachment
What does !!~ do in JavaScript? Find a detailed explanation here: http://stackoverflow.com/questions/13603656/what-does-do/
Add a comment...

Post has shared content
Ever have trouble understanding the warnings and error messages from JSHint/JSLint?

No more with this handy site which explains them with examples and common fixes. It's also up on GitHub for you to fork and improve.
Add a comment...
Wait while more posts are being loaded