Archive for July 2008

It took me a few minutes to figure this out so I thought I would post a quick note on this.  I had a situation where I wanted to render form for a new resource that was being managed by resource_controller. In this specific case I wanted to disable the layout but only for the new action (I wanted to leave my headers, etc. intact for the index action, etc.)  I was able to accomplish this easily enough by adding the following to my controller:

new_action.response do |wants|
  wants.html {render :action => :new, :layout => false}
end

Today I found myself editing a README.markdown file that was to be committed into Github.  I was pretty sure that I had the format right but I wanted to preview the content before committing in order to avoid a bunch of unnecessary commits just to fix my formatting. 

I'm still really a noob when it comes to TextMate but I correctly guessed that it could help me with this problem.  I soon learned there was a bundle that supports Markdown stuff.  After looking around for it a while I realized that I actually already have the bundle installed by default!

Pressing Control-Option-Command-P will open TextMate’s own Preview as HTML window.  Pretty sweet!

UPDATE (07.08.2008)

You can also change the default from Markdown to Textile by clicking options and replacing Markdown.pl with Textile.rb

The other day I needed to see the previous version of a file.  I had some trouble locating the command to do this so I thought I would post it here for the intrepid Googler.


git show HEAD^:filename

You can also view a specific version of the file with:



git show sha1:filename