Archive for category Website Development

Searching for a git Workflow

As we add more and more people to our team at NetPlenish, I find my self searching for a solid git workflow.

I have found a few pages that have inspired me.

We are using GitHub to manage our team. Although BitBucket just realeased its support for git and its half the price… Might consider the move.

I will update this as soon as i figure out one that makes sense for us.

What I Do Now

Best Practices

  • Commit Messages * Keep messages in present tense. * Keep message lines to 72 characters *

Git Aliases

My Git Config File

[user]
    name = Mark Evans
    email = my@emailaddress.com
[color]
    branch = auto
    diff = auto
    interactive = auto
    status = auto
    ui = auto
[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
[color "status"]
    added = yellow
    changed = green
    untracked = cyan
[alias]
    st = status
    ci = commit
    br = branch
    co = checkout
    df = diff
    lg = log -p
    who = shortlog -s --
    up = pull --rebase
    sync = !git up && git push
    stuff = !git add -A && git ci -a
    shove = !git stuff && git sync
[push]
    default = matching
[core]
    quotepath = false

Git Prommpt

My Git Prompt File

#Description: OSX Git Prompt - make your git repo prompts look pretty
#Installation: In your .bash_profile, add a line:  source .gitprompt
#FileName: .gitprompt
#Owner: Mark Evans:
#Stolen From: http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt

c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`

parse_git_branch ()
{
    if git rev-parse --git-dir >/dev/null 2>&1
    then
        gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
    else
        return 0
    fi
        echo -e $gitver
}

branch_color ()
{
    if git rev-parse --git-dir >/dev/null 2>&1
    then
        color=""
    if git diff --quiet 2>/dev/null >&2 
    then
        color="${c_green}"
    else
        color=${c_red}
    fi
    else
        return 0
    fi
    echo -ne $color
}

#Branch First
#PS1='[\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]] \u@\[${c_red}\]\w\[${c_sgr0}\]:'
#Branch Last
PS1=' \u@\[${c_red}\]\w\[${c_sgr0}\]: [\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]]'

Resources

Web Developer Tools & Tutorials

TODO:

a list of tools and tutorials to use to get setup on osx developing

OSX Lion Hates Developer

Two weeks ago I installed OSX Lion. I thought it would be great to try it out. Oddly I knew better. I thought about it the moment i clicked “install”…If only i could have gone back.

Preface

I code on a macbook pro.

The Hate Begins:

  • Missing spaces – I use spaces all the time it means i can move quickly from one space to the other. I use the grid 3×3 9 desktops nicely organized. But with Lion they replaced it with Mission Control. Which sucks, its slower, has less features(Moving apps from desktop to desktop is pain). I immediately disable auto arrangement of desktops. SLOW.
  • Desktops Auto Arrange – Mission Control thinks that its a good idea to to move apps around and desktops around based upon how often you use them. But thats not what I want because then i never know where the thing that I want to use it. SLOW. DISABLE. I simply unchecked the rearrranging based on recent use’ option in the Mission Control preferences.
  • Apache .local TLD delay BROKEN
  • Photoshop CS3 doesn’t work. BROKEN
  • Inverted mouse – are they completely oblivious? Why would i want to scroll my mouse wheel down to move the window up on my macbook… iPad=yes. computer=no. I realize there is an invert setting.. but it never should have been default. SLOW
  • Hidden Scroll bars: So i want to quickly scroll down or to the right.. i have to first scroll my wheel then grab the scroll bar indicator and drag it down. SLOW. Read the rest of this entry »

Textmate + WordPress = Love

Blogging solely within the confines of WordPress and its wysiwyg editor is horrible.

However,

Using the below items, you can really get moving.

Below is a screen shot of what it took to write this post.

Wordpress Textmate Bundle

Oh yea, it only takes a “cmd + ^ + P” key stroke to update and publish.

How to remove a submodule in git

  1. Delete the relevant line from the .gitmodules file.
  2. Delete the relevant section from .git/config.
  3. Run git rm –cached pathtosubmodule (no trailing slash).
  4. Commit and delete the now untracked submodule files.

Install APC on OSX Snow Leopared

  1. sudo pear update-channels
  2. brew install pcre
  3. sudo pecl install apc-3.1.6
  4. Edit php.ini
    1. extension=apc.so
    2. apc.enabled=1
    3. apc.shm_segments=1
    4. apc.shm_size=32M
    5. apc.cache_by_default=1
    6. apc.stat=1
    7. apc.rfc1867=1 //For upload progress.
    8. apc.stat=7200 //2 hours

Git Ignore .DS_Store on OSX

Execute the below to prevent .DS_Store from ever being included in any of your git repose.

git config --global core.excludesfile ~/.gitignore

echo .DS_Store >> ~/.gitignore

Redirect domain.com to www.domain.com in .htaccess or virtual host file

Just Add:

RewriteEngine on RewriteCond %{HTTPHOST} !^www.domain.com [NC] RewriteCond %{HTTPHOST} !^$ RewriteRule ^/?(.*) http://www.domian.com/$1 [L,R=301,NE]

Setting up a Rackspace Cloud Server & Ubuntu Karmic Koala

First Things First:

  1. Signup with Rackspace cloud: http://www.rackspacecloud.com/
  2. Create Server
    1. Choose Linux Version
    2. Choose server needs & name server
  3. You will receive a phone call and an Email will be sent to you with your server password and ip address.
  4. Test SSH Login:
    1. on a mac: run terminal
      1. ssh root@youripaddress
      2. then type in the password they gave you
  5. Start by updating your systems package manager.
    1. sudo apt-get update
    2. supo apt-get upgrade
    3. Answer yes to the additional space question.

Country Codes in PHP Array

A PHP array list of all of the countries.
$options["AF"] = "Afghanistan";  
$options["AX"] = "Åland Islands";  
$options["AL"] = "Albania ";  
$options["DZ"] = "Algeria ";  
$options["AS"] = "American Samoa";  
$options["AD"] = "Andorra";  
$options["AO"] = "Angola ";
$options["AI"] = "Anguilla ";
$options["AQ"] = "Antarctica ";
$options["AG"] = "Antigua and Barbuda ";
$options["AR"] = "Argentina";
$options["AU"] = "Australia ";
$options["AT"] = "Austria ";
$options["AZ"] = "Azerbaijan";
$options["BS"] = "Bahamas ";
$options["BH"] = "Bahrain ";
$options["BD"] = "Bangladesh ";
$options["BB"] = "Barbados ";
$options["BY"] = "Belarus";
$options["BE"] = "Belgium ";
$options["BZ"] = "Belize ";
$options["BJ"] = "Benin ";
$options["BM"] = "Bermuda ";
$options["BT"] = "Bhutan";
$options["BO"] = "Bolivia ";
$options["BA"] = "Bosnia and Herzegovina ";
$options["BW"] = "Botswana ";
$options["BV"] = "Bouvet Island ";
$options["BR"] = "Brazil";
$options["IO"] = "British Indian Ocean Territory ";
$options["BN"] = "Brunei Darussalam ";
$options["BG"] = "Bulgaria ";
$options["BF"] = "Burkina Faso ";
$options["BI"] = "Burundi";
$options["KH"] = "Cambodia ";
$options["CM"] = "Cameroon ";
$options["CA"] = "Canada ";
$options["CV"] = "Cape Verde ";
$options["KY"] = "Cayman Islands ";
$options["CF"] = "Central African Republic ";
$options["TD"] = "Chad ";
$options["CL"] = "Chile ";
$options["CN"] = "China ";
$options["CX"] = "Christmas Island";
$options["CC"] = "Cocos (Keeling) Islands ";
$options["CO"] = "Colombia ";
$options["KM"] = "Comoros ";
$options["CG"] = "Congo ";
$options["CD"] = "Congo, the Democratic Republic of the";
$options["CK"] = "Cook Islands ";
$options["CR"] = "Costa Rica ";
$options["CI"] = "Côte D'Ivoire";
$options["HR"] = "Croatia ";
$options["CU"] = "Cuba ";
$options["CY"] = "Cyprus ";
$options["CZ"] = "Czech Republic ";
$options["DK"] = "Denmark";
$options["DJ"] = "Djibouti ";
$options["DM"] = "Dominica ";
$options["DO"] = "Dominican Republic ";
$options["EC"] = "Ecuador ";
$options["EG"] = "Egypt";
$options["SV"] = "El Salvador ";
$options["GQ"] = "Equatorial Guinea ";
$options["ER"] = "Eritrea ";
$options["EE"] = "Estonia ";
$options["ET"] = "Ethiopia ";
$options["FK"] = "Falkland Islands (Malvinas) ";
$options["FO"] = "Faroe Islands ";
$options["FJ"] = "Fiji ";
$options["FI"] = "Finland ";
$options["FR"] = "France";
$options["GF"] = "French Guiana ";
$options["PF"] = "French Polynesia ";
$options["TF"] = "French Southern Territories ";
$options["GA"] = "Gabon ";
$options["GM"] = "Gambia ";
$options["GE"] = "Georgia ";
$options["DE"] = "Germany ";
$options["GH"] = "Ghana ";
$options["GI"] = "Gibraltar ";
$options["GR"] = "Greece";
$options["GL"] = "Greenland ";
$options["GD"] = "Grenada ";
$options["GP"] = "Guadeloupe ";
$options["GU"] = "Guam ";
$options["GT"] = "Guatemala";
$options["GG"] = "Guernsey ";
$options["GN"] = "Guinea ";
$options["GW"] = "Guinea-Bissau ";
$options["GY"] = "Guyana ";
$options["HT"] = "Haiti";
$options["HM"] = "Heard Island and Mcdonald Islands ";
$options["VA"] = "Holy See (Vatican City State) ";
$options["HN"] = "Honduras ";
$options["HK"] = "Hong Kong ";
$options["HU"] = "Hungary";
$options["IS"] = "Iceland ";
$options["IN"] = "India ";
$options["ID"] = "Indonesia ";
$options["IR"] = "Iran, Islamic Republic of ";
$options["IQ"] = "Iraq ";
$options["IE"] = "Ireland ";
$options["IM"] = "Isle of Man ";
$options["IL"] = "Israel ";
$options["IT"] = "Italy ";
$options["JM"] = "Jamaica";
$options["JP"] = "Japan ";
$options["JE"] = "Jersey ";
$options["JO"] = "Jordan ";
$options["KZ"] = "Kazakhstan ";
$options["KE"] = "KENYA";
$options["KI"] = "Kiribati ";
$options["KP"] = "Korea, Democratic People's Republic of ";
$options["KR"] = "Korea, Republic of ";
$options["KW"] = "Kuwait ";
$options["KG"] = "Kyrgyzstan";
$options["LA"] = "Lao People's Democratic Republic ";
$options["LV"] = "Latvia ";
$options["LB"] = "Lebanon ";
$options["LS"] = "Lesotho ";
$options["LR"] = "Liberia";
$options["LY"] = "Libyan Arab Jamahiriya ";
$options["LI"] = "Liechtenstein ";
$options["LT"] = "Lithuania ";
$options["LU"] = "Luxembourg ";
$options["MO"] = "Macao";
$options["MK"] = "Macedonia, the Former Yugoslav Republic of ";
$options["MG"] = "Madagascar ";
$options["MW"] = "Malawi ";
$options["MY"] = "Malaysia ";
$options["MV"] = "Maldives";
$options["ML"] = "Mali ";
$options["MT"] = "Malta ";
$options["MH"] = "Marshall Islands ";
$options["MQ"] = "Martinique ";
$options["MR"] = "Mauritania";
$options["MU"] = "Mauritius ";
$options["YT"] = "Mayotte ";
$options["MX"] = "Mexico ";
$options["FM"] = "Micronesia, Federated States of ";
$options["MD"] = "Moldova, Republic of";
$options["MC"] = "Monaco ";
$options["MN"] = "Mongolia ";
$options["ME"] = "Montenegro ";
$options["MS"] = "Montserrat ";
$options["MA"] = "Morocco";
$options["MZ"] = "Mozambique ";
$options["MM"] = "Myanmar ";
$options["NA"] = "Namibia ";
$options["NR"] = "Nauru ";
$options["NP"] = "Nepal";
$options["NL"] = "Netherlands ";
$options["AN"] = "Netherlands Antilles ";
$options["NC"] = "New Caledonia ";
$options["NZ"] = "New Zealand ";
$options["NI"] = "Nicaragua";
$options["NE"] = "Niger ";
$options["NG"] = "Nigeria ";
$options["NU"] = "Niue ";
$options["NF"] = "Norfolk Island ";
$options["MP"] = "Northern Mariana Islands";
$options["NO"] = "Norway ";
$options["OM"] = "Oman ";
$options["PK"] = "Pakistan ";
$options["PW"] = "Palau ";
$options["PS"] = "Palestinian Territory, Occupied";
$options["PA"] = "Panama ";
$options["PG"] = "Papua New Guinea ";
$options["PY"] = "Paraguay ";
$options["PE"] = "Peru ";
$options["PH"] = "Philippines";
$options["PN"] = "Pitcairn ";
$options["PL"] = "Poland ";
$options["PT"] = "Portugal ";
$options["PR"] = "Puerto Rico ";
$options["QA"] = "Qatar";
$options["RE"] = "Réunion ";
$options["RO"] = "Romania ";
$options["RU"] = "Russian Federation ";
$options["RW"] = "Rwanda ";
$options["SH"] = "Saint Helena";
$options["KN"] = "Saint Kitts and Nevis ";
$options["LC"] = "Saint Lucia ";
$options["PM"] = "Saint Pierre and Miquelon ";
$options["VC"] = "Saint Vincent and the Grenadines ";
$options["WS"] = "Samoa";
$options["SM"] = "San Marino ";
$options["ST"] = "Sao Tome and Principe ";
$options["SA"] = "Saudi Arabia ";
$options["SN"] = "Senegal ";
$options["RS"] = "Serbia";
$options["SC"] = "Seychelles ";
$options["SL"] = "Sierra Leone ";
$options["SG"] = "Singapore ";
$options["SK"] = "Slovakia ";
$options["SI"] = "Slovenia";
$options["SB"] = "Solomon Islands ";
$options["SO"] = "Somalia ";
$options["ZA"] = "South Africa ";
$options["GS"] = "South Georgia and the South Sandwich Islands ";
$options["ES"] = "Spain";
$options["LK"] = "Sri Lanka ";
$options["SD"] = "Sudan ";
$options["SR"] = "Suriname ";
$options["SJ"] = "Svalbard and Jan Mayen ";
$options["SZ"] = "Swaziland";
$options["SE"] = "Sweden ";
$options["CH"] = "Switzerland ";
$options["SY"] = "Syrian Arab Republic ";
$options["TW"] = "Taiwan, Province of China ";
$options["TJ"] = "Tajikistan";
$options["TZ"] = "Tanzania, United Republic of ";
$options["TH"] = "Thailand ";
$options["TL"] = "Timor-Leste ";
$options["TG"] = "Togo ";
$options["TK"] = "Tokelau";
$options["TO"] = "Tonga ";
$options["TT"] = "Trinidad and Tobago ";
$options["TN"] = "Tunisia ";
$options["TR"] = "Turkey ";
$options["TM"] = "Turkmenistan";
$options["TC"] = "Turks and Caicos Islands ";
$options["TV"] = "Tuvalu ";
$options["UG"] = "Uganda ";
$options["UA"] = "Ukraine ";
$options["AE"] = "United Arab Emirates";
$options["GB"] = "United Kingdom ";
$options["US"] = "United States ";
$options["UM"] = "United States Minor Outlying Islands ";
$options["UY"] = "Uruguay ";
$options["UZ"] = "Uzbekistan";
$options["VU"] = "Vanuatu ";
$options["VA"] = "Vatican City State ";
$options["VE"] = "Venezuela ";
$options["VN"] = "Viet Nam ";
$options["VG"] = "Virgin Islands, British ";
$options["VI"] = "Virgin Islands, U.S. ";
$options["WF"] = "Wallis and Futuna";
$options["EH"] = "Western Sahara ";
$options["YE"] = "Yemen ";
$options["CD"] = "Zaire ";
$options["ZM"] = "Zambia ";
$options["ZW"] = "Zimbabwe ";