Archive

Posts Tagged ‘self-note’

How to enable VCS infromation in zsh

March 10th, 2010 Petros No comments

If you are using zsh as your terminal in Ubuntu, you can use a built in feature to display version control information at the prompt.

After reading “Zsh Prompt Magic” I created the zsh_vcs_info file which you can download. You place it in your home directory and open .zshrc and add the following line:

source /home/user/.zsh_vcs_info

Notice that I added a . (dot) in the filename because I want it to be hidden. Also, notice that “user” in the path above, is the username of the account you use to log into Ubuntu.

Categories: tips Tags: , , , , ,

Rails: url vs path

September 21st, 2009 Petros No comments

I was wondering why some people are using _path and why some use _url. For example, if you have a Post resource you can write the following in your view:

<%= link_to 'List of posts', posts_path %>

or the following in the controller:

redirect_to posts_url

Why should I use _url in the controller. I have used _path and it seems to work.

This is an explanation I found in a forum and I quote:

*_path are for views because ahrefs are implicitly linked to the current URL. So it’d be a waste of bytes to repeat it over and over. In the controller, though, *_url is needed for redirect_to because the HTTP specification mandates that the Location: header in 3xx redirects is a complete URL.

Categories: tips Tags: , , ,

A typical workflow for a team using Git

August 27th, 2009 Petros 2 comments

Lets assume you are in a team, working on a Rails project and you have chosen Git as your version control system. One way to complete a working cycle from pull to push is:

DISCLAIMER: There are more ways and many situations that are not described here. This is only a note to self that may also be useful to you.

Read more…

Categories: tips Tags: , , ,

Git log

August 25th, 2009 Petros No comments

When I am working with git, I find it useful to take a quick look at the log. The default

$ git log

command doesn’t show the actual modified/added/deleted files. You can use the following command for that:

$ git log --pretty --stat

or

$ git log --pretty=format:"[%h] %ae, %ar: %s" --stat

I found the latter in one of Alex Young’s tweets.

If you have any favorite git log formats, please feel free to mention them in a comment.

Categories: tips Tags: , ,

Installing RSpec and Cucumber

July 11th, 2009 Petros No comments

Open your shell and,

For RSpec:

$ gem install rspec

For Cucumber:

$ gem install cucumber

Optionally, if you are on Windows, for color output you can also install Win32Console:

$ gem install win32console
Categories: tips Tags: , , , ,