Skip to content

Instantly share code, notes, and snippets.

View mzaragoza's full-sized avatar

Moises Zaragoza mzaragoza

View GitHub Profile
You can add the following code to you .bashrc file:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$(parse_git_branch) $ "
You can move around these component parts to configure to your tastes, for example to prepend $(parse_git_branch) and not show the user@computer part I used:
PS1="\$(parse_git_branch)${debian_chroot:+($debian_chroot)}\w$ "
https://openid.stackexchange.com/account/affiliate/complete-registration?affId=4&authCode=ehxvsqtS8uKSe8ZnUv4M09og2K8%3d&callback=http%3a%2f%2fstackoverflow.com%2fusers%2fauthenticate&email=gia%40moiseszaragoza.com&realname=Gia+Furn&token=87dd8d6b-bbb7-4e72-8794-baaa25fdfa55
@mzaragoza
mzaragoza / gist:6501997
Created September 9, 2013 21:48
config/initializers/strings.rb
class String
def map(arg=nil)
if arg
[self].map(arg)
elsif block_given?
[self].map{|i| yield(i)}
else
[self]
end
end
@mzaragoza
mzaragoza / gist:6437267
Created September 4, 2013 13:56
BASHRC
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion
alias bashrc="vim ~/.bashrc.local"
alias remove_all_gems='gem list | cut -d" " -f1 | xargs gem uninstall -aIx'
cat <<INPUTRC >~/.inputrc
set completion-ignore-case On
TAB: menu-complete
INPUTRC
@mzaragoza
mzaragoza / gist:6437255
Created September 4, 2013 13:55
exclude personal files
Here is where you exclude personal files
.git/info/exclude
@mzaragoza
mzaragoza / gist:5490145
Created April 30, 2013 17:03
Setting up Heroku Hostname SSL with GoDaddy SSL Cert
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing).
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here:
* Heroku Hostname SSL
* GoDaddy Standard SSL Certificate
* Zerigo DNS
Note: I am not using the Heroku Zerigo DNS add-on, instead I have a separate Zerigo account for my DNS needs. I do this because Zerigo offers 30 hosts on free direct accounts, versus only 10 hosts on the free Heroku add-on.
I. Getting a GoDaddy SSL Certificate (Part I)
@mzaragoza
mzaragoza / gist:5221795
Created March 22, 2013 14:44
MYSQL FIND ANYTHING IN DB
<?php
session_start();
define("mz_DB_USERNAME", "XXXXXX");
define("mz_DB_PASSWORD", "XXXXXX");
define("mz_DB_HOST", "XXXXXX");
define("mz_DB_DATABASE", "XXXXXX");
require_once('config.inc.php');
require_once('__database_class.php');
$db = new mz_database();
@mzaragoza
mzaragoza / gist:2936939
Created June 15, 2012 15:11 — forked from netzpirat/gist:238162
Running webrat and celerity parallel
We couldn’t find that file to show.
test
i have a repo set up but its been a while sines i have done anything i see that i am set (devise_admin) but when i want to do a git pull i get
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
any idea what to do?