Denis Barushev

Email: barushev@gmail.com

Reduce PDF File Size

Use the following ghostscript command:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/screen -dNOPAUSE -dQUIET \
-dBATCH -sOutputFile=output.pdf input.pdf

Source

ImageMagick Mirror Virtual Pixels

It’s very useful for generating image edges that are mirrored around the boundaries of the image:

convert tree.gif -set option:distort:viewport 70x70-19-19 \
  -virtual-pixel Mirror -filter point -distort SRT 0 \
  +repage virtual_mirror.gif

See: http://www.imagemagick.org/Usage/misc/#mirror

-bash: __git_ps1: command not found

If you use homebrew and have updated your git to 1.7.12 you should see this annoying message instead of your beautiful prompt:

-bash: __git_ps1: command not found

To solve the problem just add this line to your ~/.profile ( ~/.bash_profile, ~/.bashrc) before setting PS1:

source /usr/local/share/git-core/contrib/completion/git-prompt.sh

Update: The issue was fixed in the latest version of the git homebrew formula:

brew update
brew uninstall git
brew install git

RSpec Rails be_a_new matcher

Passes if the object is a Widget and returns true for new_record?:

object.should be_a_new(Widget)

Reset Heroku Database and Reload Seeds

Since heroku rake db:migrate:reset doesn’t work you should run:

heroku pg:reset SHARED_DATABASE --confirm <APP_NAME>
heroku rake db:migrate