Categories
OSX

Git Completion with Terminal/iTerm output theme

Install Git Completion:

Save the git-completion.bash file in your home directory:

Installation

Open your .bash_profile

nano ~/.bash_profile

Paste the following at the top of the file, make sure not to overwrite any other settings you may have put in the file.

###### GIT COMPLETION - START ######
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}

# Colour Variables
BLACK="\[\033[0;30m\]"
BLACKBOLD="\[\033[1;30m\]"
RED="\[\033[0;31m\]"
REDBOLD="\[\033[1;31m\]"
GREEN="\[\033[0;32m\]"
GREENBOLD="\[\033[1;32m\]"
YELLOW="\[\033[0;33m\]"
YELLOWBOLD="\[\033[1;33m\]"
BLUE="\[\033[0;34m\]"
BLUEBOLD="\[\033[1;34m\]"
PURPLE="\[\033[0;35m\]"
PURPLEBOLD="\[\033[1;35m\]"
CYAN="\[\033[0;36m\]"
CYANBOLD="\[\033[1;36m\]"
WHITE="\[\033[0;37m\]"
WHITEBOLD="\[\033[1;37m\]"
RESETCOLOR="\[\e[00m\]"
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)


# Define the terminal output string: username in path - branch
export PS1="${REDBOLD}\u ${RESETCOLOR}in ${CYANBOLD}\w ${GREEN}-\$(parse_git_branch)${RESETCOLOR} $ "


# Include the git completion file (must be saved in your home directory for this to work)
# Source: https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
if [ -f ~/.git-completion.bash ]; then
 . ~/.git-completion.bash


 # Add git completion to aliases
 __git_complete gco _git_checkout
 __git_complete gb _git_branch
 __git_complete gc _git_commit
fi
###### GIT COMPLETION - END ######

Reload .bash_profile

source ~/.bash_profile
Categories
Web Development

Regex for Alphanumeric Only – No Spaces, dashes or Underlines

Regex for A-Z, 0-9 and limited to 0-32 characters

Pattern:

/^[a-zA-Z0-9]{0,32}$/

Usage

if (preg_match('/^[a-zA-Z0-9]{0,32}$/', $mystring))
{
    return true;
}

 

Categories
Web Development

Redirect all Traffic to HTTPS

In the .htaccess file add:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

Categories
Web Development

Import large database files to MySQL using Terminal with MAMP

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot DBNAME < /Users/robertannett/Downloads/DBFILENAME.sql

 

Categories
Web Development

PayPal WooCommerce return URL

Under Website Selling Preferences turn on Auto Return and the url for WooCommerce should be:

https://yourdomain.com/checkout/order-received/?utm_nooverride=1

 

Categories
Web Development

Replace the Blank Line in Contact form 7 Select List

function my_wpcf7_dropdown_form($html) {
    $text = 'Your Replacement text here';
    $html = str_replace('---', '' . $text . '', $html);
    return $html;
}
add_filter('wpcf7_form_elements', 'my_wpcf7_dropdown_form');

 

Categories
Brand

Interesting Studios & Agencies

A list of interesting studios, agencies & creatives.

Ireland

Brand Consultancies

Individuals

International

Europe

Studios

Advertising Agencies

Media

Photographers

Blogs

Resources

Categories
Brand

Creative Resources

An evolving directory of visual reference. I’d recommend putting all the links into an rss reader like feedly. Very easy to flick through quickly.

General Creativity

Branding

Design

Typography

Education

Webdesign / UIUX

Advertising

Packaging

Misc.

 

Illustration

Art

 

Categories
Brand

Typography Resources

Typography Resources & Tools:

Type Detail –  A collection of lots of  different typographic resources

Buttericks Practical Typography – Guide to typography

Typography Supply – An inventory of Typographic Tools

Good Type Foundries

Letters From Sweden

Swiss Typefaces

Colophon

Klim 

Radim Pesko

Commercial Type

A2-Type

F37 Foundry

Dalton Maag

Lineto

The Designers Foundry

 

Categories
Web Development

Custom WordPress Excerpt

<?php echo wp_trim_words( get_the_excerpt(), 50, ‘…’ ); ?>