Joined February 2012
·

Spencer Williams

Software Developer at SiftIt, LLC
·
USA
·
·
·

Posted to Get Lazy in javascript coding over 1 year ago

Principle of least surprise says:

// clear: this variable is a number.
var numberizedString = Number("100"); 
// easy-to-miss unary plus, easy to mistake as binary plus
var lazyWay = +'100'; 

// clear: this variable is a string
var stringifiedNumber = 100..toString(); 
// not obvious: we're concatenating an empty string? Why?
var lazyWay = '' + 100; 
Posted to Using Backbone with RequireJS over 1 year ago

So does this use a non-AMD version of lodash? I've tried dropping in the AMD version with little success (because Backbone tries to require('underscore') if it doesn't find a _ global)

Check out Marionette. It's got a CollectionView and an ItemView built-in (among other useful tools)

Posted to Copy yanked text to vim command line over 1 year ago

This works in insert mode too! Also useful in insert mode: inserting from the "=" register, which lets you insert the result of vim commands.

Posted to Styling your HR tag using just HTML over 1 year ago

That's...not actually "just HTML". That's inline CSS, which is usually not recommended. Most web designers recommend that HTML be used for page structure and semantics while styling be kept to external CSS stylesheets.

Posted to per directory zsh config over 1 year ago

Does this introduce any noticeable slowdown when changing directories?

Posted to Switch to a different Linux user over 1 year ago

Less of a protip and more of a "rudimentary basics of Linux system administration".

Posted to Java and JavaScript over 1 year ago

@anoras I'm gonna have to use this in the future.

Another alternative:

sed -i 's/find_this/replace_with_this/g' parent/directory/*/.rb

Posted to making it up over 1 year ago

...is there a protip in here somewhere?

Posted to Displaying your git commits better! over 1 year ago

What's the output of this look like? Any examples?

Linux user here: I don't have pbcopy, and I don't see it in Ubuntu's repos. Since Ubuntu is one of the more common Linux distros, I think it's safe to say that this is not common to many unix users.

So where is pbcopy available? OSX?

Posted to Autocomplete last command's param over 1 year ago

Alt+. also works, from my experience.

Alternatively, just use the .toggle(function(), function()) method.

Well, this is odd. Looks like Coderwall munged the "at" in the decorators into links. weird.

Achievements
274 Karma
34,185 Total ProTip Views