Category: Others

How to Customizing iterm2 with ZSH and Powerline Fonts

  1. Download iTerm2 and install it.
  2. Install ZSH with terminal, ex: sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  3. Download Cobalt2 and drop the cobalt2.zsh-theme file in to the open ~/.oh-my-zsh/themes/ directory.
  4. Open up your ZSH preferences at open ~/.zshrc and change the theme variable to ZSH_THEME=cobalt2.
  5. Install Powerline and necessary fonts, one way is using PIP.

For first time PIP users you need to install PIP sudo easy_install pip

To install Powerline using pip

pip install --user powerline-status

Now install all necessary fonts by downloading or cloning git repository.

git clone https://github.com/powerline/fonts
cd fonts
./install.sh
  1. In iTerm2 access the Preferences pane on the Profiles tab.
  2. Under the Colors tab import the cobalt2.itermcolors file via the Load Presets drop-down.
  3. Under the Text tab change the font for each type (Regular and Non-ASCII) to ‘Inconsolata for Powerline‘. (Refer to the powerline-fonts repo for help on font installation.)
  4. Refresh ZSH by typing source ~/.zshrc on the command line.

Git Commands

Creating tags from the command line:

To create a tag on your current branch, run this:

git tag <tagname>

If you want to include a description with your tag, add -a to create an annotated tag:

git tag <tagname> -a

This will create a local tag with the current state of the branch you are on. When pushing to your remote repo, tags are NOT included by default. You will need to explicitly say that you want to push your tags to your remote repo:

git push origin --tags

From the official Linux Kernel Git documentation for git push:

--tags

All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

Or if you just want to push a single tag:

git push origin <tag>

See also my answer to How to push a tag to a remote repository using Git? for more details about that syntax above.

How to show top selling items on EDD

Use this query for showing top selling items.

$popular_items = new WP_Query (array(
	'post_type' => 'download',
	'orderby'   => 'meta_value_num',
	'meta_query'     => array(
		'relation' => 'AND',
		array(
			'key'     => '_edd_download_sales',
			'compare' => '>',
			'value'   => 0,
			'order'   => 'DESC',
		),
	),
	'posts_per_page' => 3
));