Skip to content

Instantly share code, notes, and snippets.

@mycargus
mycargus / .txt
Last active August 29, 2015 14:18
A collection of .gitignore files
_
@mycargus
mycargus / .bash_profile
Last active October 4, 2016 23:39
My mac bash setup
[[ -s ~/.bashrc ]] && source ~/.bashrc # load .bashrc
[[ -s ~/.bash_profile_instructure ]] && source ~/.bash_profile_instructure # load .bash_profile_instructure
testButton1.TouchUpInside += delegate {
new UIAlertView("Touch1", "TouchUpInside handled", null, "OK", null).Show();
};
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
public static UIStoryboard Storyboard = UIStoryboard.FromName ("MainStoryboard", null);
public static UIViewController initialViewController;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
@mycargus
mycargus / uninstall_homebrew
Created May 14, 2015 05:59
uninstall homebrew
rm -rf /usr/local/Cellar/ /usr/local/.git && brew cleanup
You shouldn’t.
Homebrew intentionally keeps /usr/local/bin after /usr/bin in the path for maximum compatibility. Reversing the order of these directories in PATH by editing /etc/paths would mean that all programs anywhere on the system, no matter how they were started, will get the Homebrew version of a command. But some may specifically expect Apple’s version, or just not be able to use a newer version, etc.
How to preserve this principle and still get the Homebrew-installed version of git? As the saying goes, all problems can be solved with a layer of indirection (except having too many layers of indirection). — Or in this case, as it turns out, two layers.
Specifically, it’s been part of my Unix habits to have a ~/bin directory which I put at the start of my PATH. This is one of the first bits in my .bashrc:
case ":$PATH:" in
*:$HOME/bin:*) ;; # do nothing if $PATH already contains $HOME/bin
brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
# Install Ruby
rbenv install 2.2.2
rbenv global 2.2.2
ruby -v
# If id command returns zero, you’ve root access.
if [ $(id -u) -eq 0 ];
then # you are root, set red colour prompt
PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]"
else # normal
PS1="[\\u@\\h:\\w] $"
fi