# Put /usr/local/bin/ before /usr/bin/ to ensure the programs provided by
# Homebrew will be used instead of those system-provided.
export PATH="/usr/local/bin:$PATH"
Save changes to ~/.bash_profile and then restart Terminal.
Try out Homebrew
brew doctor // run this everytime before/after installing any new formula
brew install git
brew install wget
brew list
brew update
brew search <formula>
brew upgrade <formula>
brew info <formula>
brew uninstall <formula>
brew help
# Add RVM to PATH for scripting
export PATH="$PATH:$HOME/.rvm/bin"
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
source "$HOME/.rvm/scripts/rvm";
fi
There are several scenarios where we have to provide users recovery options while the application encountered an error. However, creating a recoverable NSError is not a very pleasant experience. It's just tedious, so I wrapped up the creation process into one single API with block support.
This NSError category changed the process of creating a recoverable NSError from
// somewhere in recoveryDelegate's implementation file
#pragma mark NSErrorRecoveryAttempting Protocol
// This will be invoked while the error was presented with -[NSView presentError:modalForWindow:....]
- (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo
{
// Do something here to recover the error based on the selected option
}
// This will be invoked while the error was presented with -[NSApp presentError:]
- (BOOL)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex
{
// Do something here to recover the error based on the selected option
return YES;
}
to
NSError *error = [NSError ot_errorWithTitle:@"title"
recoverySuggestion:@"suggestion"
recoveryOptions:[NSArray arrayWithObjects:@"default", @"alternate", @"other option", nil]
recoveryHandler:^(NSUInteger optionIndex) {
// Do something here to recover the error based on the selected option
}];
You can obtain the source code here. Happy coding!