This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
| # Tell system when Xcode utilities live: | |
| sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
| # Set "opendiff" as the default mergetool globally: | |
| git config --global merge.tool opendiff |
| // underscore's throttle-metod | |
| var throttle = function(func, wait) { | |
| var context, args, timeout, throttling, more, result; | |
| var whenDone = _.debounce(function(){ more = throttling = false; }, wait); | |
| return function() { | |
| context = this; args = arguments; | |
| var later = function() { | |
| timeout = null; | |
| if (more) func.apply(context, args); |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
| // It is important to declare your variables. | |
| (function() { | |
| var foo = 'Hello, world!'; | |
| print(foo); //=> Hello, world! | |
| })(); | |
| // Because if you don't, the become global variables. | |
| (function() { |