I'll add another endorsement of that book, it's pretty fantastic. Thanks for the reminder of it, I haven't gone through it "properly" and actually run the code samples; I'll be doing that over my winter vacation.
@demianbrecht: I'll just invoke Crockford: https://www.youtube.com/watch?v=RO1Wnu-xKoY#t=1h19m31s
@mmontag Does re-cloning work? There's definitely a lot of ways that git can get corrupted, and its error messages aren't the best. I can't really help any further without more information
I'd just like to emphasize that angular's built-in cacheFactory's simplicity is its greatest strength, not a weakness. It has a tiny footprint that keeps angular's code small. It's great! All it is is an object and a linked list. And angularCacheFactory is great too! It's there when you need more, and uses a more complex, but more flexible heap structure.
Good post. Thanks for your work.
@demianbrecht using a unary +
prefix to coerce to number, !!
to coerce to boolean, and ''+
to coerce to string are commonplace, so as long as it's in your project's style guide, readability shouldn't be a problem here, since it's re-using preexisting commonplace idioms. If, in your styleguide, you use Number()
, Boolean()
, and String()
, then I would advocate continued usage of parseInt()
.
@fardjad @gnclmorais Whoops, that's one of the other advantages that I forgot to add. My first usage does have the radix, however. In fact, it was looking at others' code that didn't use the radix that made me think of this problem in the first place.
Figuring out performance heuristics in JIT implementations is hard:
http://jsperf.com/anonymous-vs-named-settimeout-in-a-loop/2
(I'm a pythonista, so I prefer naming my functions anyways :P )
Better wrap that function call with a try/catch, or else you'll end up with a console.group that never ends!
I've actually wanted to write a sublime plugin that will, instead of indenting the current line with something like c-super-left/right, will move the current word around, like how your cursor will move while holding alt(mac)/ctrl(others), which would be especially useful for rearranging array/list elements, etc.