Drew Wells
Member since Mar 10, 2010
- Profile: /members/5627-drew-wells.htm
- URL: http://drewwells.net/blog
- Comments: 54
Recent Blog Comments By Drew Wells
-
Cross-Origin Resource Sharing (CORS) AJAX Requests Between jQuery And Node.js
Posted on Feb 10, 2012 at 11:30 AM
After you understand the concepts here, this is an awesome cheatsheet for enabling CORS in just about anything http://enable-cors.org/... read more »
-
Using jQuery As A Named Module In RequireJS
Posted on Nov 17, 2011 at 9:31 AM
How about showing how you require jquery from a cdn. @ Mr. Burke, Does this work work with r.js? I've traditionally had issues when building with code outside define calls.... read more »
-
Global Events vs. Entity-Bound Events In JavaScript Application Architecture
Posted on Nov 2, 2011 at 11:18 AM
Check $.Callbacks http://addyosmani.com/blog/jquery-1-7s-callbacks-feature-demystified/ Maybe that will push you off the fence... read more »
-
Experimenting With Sub() And Deferred Objects In jQuery 1.5
Posted on Sep 20, 2011 at 5:06 PM
Use .pipe() to chain multiple (dynamically retrieved) ajax requests ie. .when(ajax1).when(ajax2).pipe(function( ajax1, ajax2){ if( ajax1.more ){ //omg need more return $.when( ajax1.more ) } }).then( /*all done*/ ); Here's something I wrote in case I ran into the problem again, fill in... read more »
-
Javascript's hasOwnProperty() Method Is More Consistent Than The IN Operator
Posted on Aug 31, 2011 at 10:39 AM
True, hasOwnProperty() is used to distinguish actual properties of an object from those in the prototype. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/hasOwnProperty in is a pretty horrible way to find properties, because it requires the browser to find ALL properti... read more »
-
Trying Out LAB.js For Asynchronous JavaScript (Script) Loading
Posted on Jul 19, 2011 at 9:11 PM
Just from taking a gander at your code, it was a bit scary everything modified the global. Have you looked at RequireJS? With RequireJS every file is at most one module, and no file isn't a module (or shouldn't be). A module is in the most simple since a file containing a single define fun... read more »
-
Branching Logic vs. Guard Logic When It Comes To Function Control Flow
Posted on Jun 23, 2011 at 11:26 PM
@Elliott, I wanted to test returns inside a function, I can't test those without paying the cost of opening a function :P. So obviously, calling a method costs far more than premature returns 'guarded logic' inside it. Of course, some code that requires no if/then/else would be faster than some t... read more »
-
Branching Logic vs. Guard Logic When It Comes To Function Control Flow
Posted on Jun 23, 2011 at 11:21 PM
@Elliott,... read more »
-
Branching Logic vs. Guard Logic When It Comes To Function Control Flow
Posted on Jun 23, 2011 at 11:15 PM
@Elliott, Math.random() probably is affecting the performance, but so is the function call itself. Branching logic has a major impact on performance this was just not a good test of it. A true test would remove the function call as well.... read more »
-
Branching Logic vs. Guard Logic When It Comes To Function Control Flow
Posted on Jun 23, 2011 at 10:54 PM
I know you tackled this question in ColdFusion, but I just had a revelation that this could kill JS performance and jsperf confirmed it: http://twitter.com/#!/oneguystudio/status/84091367088852992... read more »
-
JavaScript Web Applications By Alex MacCaw
Posted on May 30, 2011 at 12:46 PM
There are no classes in JavaScript or the class keyword wouldn't throw an error... somebody famous should rename objects used to create other objects to create less confusion on the topic... read more »
-
Using JavaScript's With Keyword To Create A Dynamic Scope Chain For Method Execution
Posted on May 27, 2011 at 5:56 PM
Crockford said with was bad, so let's do the exact same thing with catch! try{ new Throw() } catch ( scope ){ //Woohoo! }... read more »
-
Javascript: The Good Parts By Douglas Crockford
Posted on May 19, 2011 at 10:00 AM
@WebManWalking, Yeah with is interesting and I must say I rarely use it, because of fear over it's downsides. However, it is used heavily in Firebug. Zakas and Crockford also defer on JSLint, Zakas seems to given up the fight for Lint and switched to using JSHint: https://github.com/jshint/jshin... read more »
-
Javascript: The Good Parts By Douglas Crockford
Posted on May 19, 2011 at 1:40 AM
I agree it's well written and he expresses his thoughts. It came with too any opinions instead of insights into the language. I liked the train diagrams, but I didn't like his opinions on code structure. Every if should have a block {}, but i++ is much more readable than i = i + 1. The nail in t... read more »
-
Returning NULL Values In JSON Using SerializeJSON() And ColdFusion
Posted on Apr 5, 2011 at 2:16 PM
@Henry, Nope, I was lucky to find it, otherwise jQuery tries to serialize your data for you. I had the unfortunate experience of debugging this while using a proxy, so after many hours of Wireshark I discovered the issue.... read more »
-
Returning NULL Values In JSON Using SerializeJSON() And ColdFusion
Posted on Apr 5, 2011 at 11:03 AM
@Ben, It is further complicated in the case where you need to push things through a proxy. For instance, the curl module in PHP does not support JSON. I am currently using Apache mod proxy for testing, and still unsure what to use in production hopefully Ruby can provide a cross platform/http-ser... read more »
-
Returning NULL Values In JSON Using SerializeJSON() And ColdFusion
Posted on Apr 5, 2011 at 10:49 AM
I have a strong emotional response to JSON-RPC. We internally have a server API that requires requests made in JSON and returns JSON responses. Getting back JSON responses is quite normal, and many interfaces implement this without calling themselves 'JSON-RPC'. The significant issue is making re... read more »
-
Arguments.length In Javascript Depends On Invocation Arguments, Not Function Signatures
Posted on Mar 24, 2011 at 4:33 PM
@Ben, yep arity is apparently the CS notion of the arguments of a function. At least that's what I read from some arcane manuscript long before the days of duck punching :D!... read more »
-
Arguments.length In Javascript Depends On Invocation Arguments, Not Function Signatures
Posted on Mar 24, 2011 at 4:11 PM
Have you read this interesting approach to function overloading? http://ejohn.org/blog/javascript-method-overloading/ callee is removed in strict mode as it breaks encapsulation. I thought the same was true of function.length at least in becoming a deprecated or removed method.... read more »
-
Eloquent Javascript: A Modern Introduction To Programming By Marijn Haverbeke
Posted on Mar 22, 2011 at 3:13 PM
He has also posted his book online here: http://eloquentjavascript.net/ With a totally awesome emacs-style IDE to test the examples in.... read more »