<?xml version="1.0" encoding="UTF-8"?>
<snippets type="array">
  <snippet>
    <author>Aaron Godin</author>
    <code>$('body').animate({
  scrollTop: $('#target').offset().top
});</code>
    <created-at type="datetime">2010-08-11T09:29:11-07:00</created-at>
    <description></description>
    <id type="integer">184</id>
    <title>jQuery ScrollTo</title>
    <updated-at type="datetime">2010-08-11T09:29:11-07:00</updated-at>
    <language-string>JavaScript</language-string>
    <tags type="array">
      <tag>
        <name>jQuery</name>
      </tag>
      <tag>
        <name>Javascript</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Aaron Godin</author>
    <code>1. Go to Track &gt; Show Master Track
2. On the Master Track, select the Master Tempo to automate.
3. It works like any other automation, so you can do a gradual slow down or and immediate tempo change.</code>
    <created-at type="datetime">2010-07-28T11:18:01-07:00</created-at>
    <description></description>
    <id type="integer">183</id>
    <title>Changing tempo in garageband mid song</title>
    <updated-at type="datetime">2010-07-28T11:18:01-07:00</updated-at>
    <language-string>Plain</language-string>
    <tags type="array">
      <tag>
        <name>GarageBand</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Thoughtbot</author>
    <code>When /^I post to "([^\"]*)" as "(.*)\/(.*)" with the following params:$/ do |path, username, password, table|
  basic_auth(username, password)
  post_params = table.hashes.first
  visit path, :post, post_params
end</code>
    <created-at type="datetime">2010-04-16T10:17:18-07:00</created-at>
    <description></description>
    <id type="integer">182</id>
    <title>Cuke step for basic auth</title>
    <updated-at type="datetime">2010-04-16T10:17:18-07:00</updated-at>
    <language-string>Apache</language-string>
    <tags type="array">
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>cucumber</name>
      </tag>
      <tag>
        <name>webrat</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>  require 'nokogiri'
  
  def slideshare_embed_list(username)
    rss_url = "http://www.slideshare.net/rss/user/#{username}/presentations"
    input = Nokogiri::XML(Kernel.open(rss_url))
    output = "&lt;ul&gt;"
    input.root.xpath("//slideshare:embed").each {|n| output &lt;&lt; "&lt;li&gt;#{n.text}&lt;/li&gt;"}
    output &lt;&lt; "&lt;/ul&gt;"
  end

  def slideshare_list(username)
    rss_url = "http://www.slideshare.net/rss/user/#{username}/presentations"
    input = Nokogiri::XML(Kernel.open(rss_url))
    output = "&lt;ul&gt;"
    input.root.xpath("//media:content").each do |n|
      img = n.xpath("media:thumbnail").attr("url")
      link = n.xpath("media:player").attr("url")
      title = n.xpath("media:title").text
      desc = n.xpath("media:description").text
      
      output &lt;&lt; %Q{
        &lt;div class="item"&gt;

          &lt;span class="image"&gt;
            &lt;a href="#{link}" class="popup"&gt;&lt;img src="#{img}" alt="#{title}"&gt;&lt;/a&gt;
          &lt;/span&gt;
          &lt;span class="text"&gt;
            &lt;h4&gt;#{title}&lt;/h4&gt;
            &lt;p&gt;#{desc}&lt;/p&gt;
          &lt;/span&gt;
          &lt;div class="clear"&gt;&lt;/div&gt;  

        &lt;/div&gt;
      }

    end
    output &lt;&lt; "&lt;/ul&gt;"
  end</code>
    <created-at type="datetime">2010-02-26T18:46:02-08:00</created-at>
    <description>This pulls in your slides from Slideshare and builds either an unordered list of embed calls which you could style to your liking, or a more customizable list of thumbnails.
</description>
    <id type="integer">180</id>
    <title>Work with your Slideshare feed</title>
    <updated-at type="datetime">2010-02-26T20:24:51-08:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>Ruby</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>mkdir -p .vim/autoload
mkdir -p .vim/backup
mkdir -p .vim/bundle

cd .vim/bundle
git clone git://github.com/tpope/vim-rails.git
git clone git://github.com/tpope/vim-cucumber.git
git clone git://github.com/tpope/vim-haml.git
git clone git://github.com/tpope/vim-endwise.git
git clone git://github.com/scrooloose/nerdtree.git
git clone git://github.com/scrooloose/nerdcommenter.git
git clone git://github.com/tpope/vim-surround.git

cd ../..

curl http://github.com/tpope/vim-pathogen/raw/master/autoload/pathogen.vim &gt; .vim/autoload/pathogen.vim

echo "filetype off
call pathogen#runtime_append_all_bundles()

syntax on
set nocompatible              \"don't need to keep compatibility with Vi
set background=dark           \"make vim use colors that look good on a dark background
set showcmd                   \"show incomplete cmds down the bottom
set showmode                  \"show current mode down the bottom

set incsearch                 \"find the next match as we type the search
set hlsearch                  \"hilight searches by default
set autoindent

set shiftwidth=2              \"number of spaces to use in each autoindent step
set tabstop=2                 \"two tab spaces
set softtabstop=2             \"number of spaces to skip or insert when &lt;BS&gt;ing or &lt;Tab&gt;ing
set expandtab                 \"spaces instead of tabs for better cross-editor compatibility
set autoindent                \"keep the indent when creating a new line
set smarttab                  \"use shiftwidth and softtabstop to insert or delete (on &lt;BS&gt;) blanks
set cindent                   \"recommended seting for automatic C-style indentation
set autoindent                \"automatic indentation in non-C files

set cursorline
set cursorcolumn
set wildmenu                  \"make tab completion act more like bash
set wildmode=list:longest     \"tab complete to longest common string, like bash

set mouse-=a                  \"disable mouse automatically entering visual mode

set wrap!
set bs=2
set number
set hidden                    \"allow hiding buffers with unsaved changes
set cmdheight=2               \"make the command line a little taller to hide "press enter to viem more" text
set backupdir=$HOME/.vim/backup
set directory=$HOME/.vim/backup

let mapleader = ","           \"remap leader to ',' which is much easier than '\'
map &lt;Leader&gt;d :NERDTreeToggle&lt;CR&gt; :set number&lt;CR&gt;  \"make nerdtree open when you hit ,d
" &gt;&gt; .vimrc   </code>
    <created-at type="datetime">2010-02-21T11:47:56-08:00</created-at>
    <description>Script I've been using to set up vim on my EEE and macbook. Still in progress, but it's kinda neat.</description>
    <id type="integer">179</id>
    <title>VIM setup</title>
    <updated-at type="datetime">2010-08-17T18:21:23-07:00</updated-at>
    <language-string>Bash</language-string>
    <tags type="array">
      <tag>
        <name>vim</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Jon Kinney</author>
    <code>require 'find'

def find_and_print(path, pattern)
  Find.find(path) do |entry|
    if File.file?(entry) and entry[pattern]
      has_transparency = `identify -format %A #{entry}`
      if has_transparency.to_s.chomp.strip == "True"
        puts "#{entry}"
      end
    end
  end
end
 
# print all the ruby files
find_and_print("/rails_app/public/images", /.+\.png$/)</code>
    <created-at type="datetime">2010-02-19T09:52:57-08:00</created-at>
    <description>This requires that you have ImageMagick installed on whatever machine you run it on as the `identify -format %A file.png` bit is actually a shell command for ImageMagick. Ruby just was easier for me to figure out how to recursively run that on all .png files in a given directory. I'm sure there is a shorter shell script to do the same thing. The script will probably run without ImageMagick installed, but it most likely won't give any output.</description>
    <id type="integer">178</id>
    <title>Check a directory for transparent pngs recursively</title>
    <updated-at type="datetime">2010-02-19T10:02:19-08:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>Ruby</name>
      </tag>
      <tag>
        <name>shell</name>
      </tag>
      <tag>
        <name>ImageMagick</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>    def random_password
  
      c = %w( b c d f g h j k l m n p qu r s t v w x z ) +
      %w( ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr )
      v = %w( a e i o u y )
      f, r = true, ''
  
      6.times do
        r &lt;&lt; ( f ? c[ rand * c.size ] : v[ rand * v.size ] )
        f = !f
      end
    
      2.times do
        r &lt;&lt; ( rand( 9 ) + 1 ).to_s
  
      end
      r
    end</code>
    <created-at type="datetime">2010-01-11T07:00:41-08:00</created-at>
    <description>Generate a random password
</description>
    <id type="integer">177</id>
    <title>Random password</title>
    <updated-at type="datetime">2010-01-11T07:00:41-08:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>security</name>
      </tag>
      <tag>
        <name>Rails</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;

&lt;html lang="en"&gt;
&lt;head&gt;

	&lt;title&gt;untitled&lt;/title&gt;
	&lt;meta name="generator" content="TextMate http://macromates.com/"&gt;
	&lt;meta name="author" content=""&gt;
	&lt;!-- Date: 2009-12-07 --&gt;
	
	&lt;script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" charset="utf-8"&gt;
    $(function(){   // shortcut for 'do this when page is ready'
      // find all transcript divs and hide them
      var transcripts = $('.transcript');
      transcripts.hide();
      
      // loop over all transcript regions on the page
      // and add a link that will toggle the transcript region
      // on and off
      transcripts.each(function(){
        make_link_for($(this));  
      });
    
      function make_link_for(item){
        
        // create a new link with the text "Show transcript" with a class of "toggle"
        // and bind the "click" event. When clicked,
        // call the toggle_transcript function.
        var new_link = $("&lt;a href='#" + item.attr("id") + "' class='toggle'&gt;Show transcript&lt;/a&gt;")
          .click(function(event){
            toggle_transcript(item, $(this))
            event.preventDefault();            
          });
          item.parent().append(new_link);
      }
      
      // Toggles the given transcript.
      // Takes in the transcript object to toggle on or off
      // and the link so that its text can be changed between "show" or "hide"
      function toggle_transcript(item, link){
        link.html(link.html() == 'Show transcript' ? 'Hide transcript' : 'Show transcript');
        item.toggle();
      }

    
    });
  &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

  &lt;div id="audio_1"&gt;
    &lt;h1&gt;Audio file 1&lt;/h1&gt;
    &lt;object width="550" height="400"&gt;
    &lt;param name="movie" value="somefilename.swf"&gt;
    &lt;embed src="somefilename.swf" width="550" height="400"&gt;
    &lt;/embed&gt;
    &lt;/object&gt;
    &lt;div class="transcript" id="transcript_for_audio_1"&gt;
      &lt;h1&gt;Audio One&lt;/h1&gt;
      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      &lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="audio_2"&gt;
    &lt;h1&gt;Audio file 2&lt;/h1&gt;
    &lt;object width="550" height="400"&gt;
    &lt;param name="movie" value="somefilename.swf"&gt;
    &lt;embed src="somefilename.swf" width="550" height="400"&gt;
    &lt;/embed&gt;
    &lt;/object&gt;
    &lt;div class="transcript" id="transcript_for_audio_2"&gt;
      &lt;h1&gt;Audio 2&lt;/h1&gt;
      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      &lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code>
    <created-at type="datetime">2009-12-07T07:57:49-08:00</created-at>
    <description>Code to show or hide transcripts for embedded audio. Adds the "show transcript" links to the document via Javascript and performs the region toggling.</description>
    <id type="integer">176</id>
    <title>JQuery show hide with link toggle</title>
    <updated-at type="datetime">2009-12-07T08:03:16-08:00</updated-at>
    <language-string>HTML / XHTML</language-string>
    <tags type="array">
      <tag>
        <name>Javascript</name>
      </tag>
      <tag>
        <name>jQuery</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Chris Johnson</author>
    <code>for i in /photos/*.jpg
do
  convert -sample 50x50 "$i" "`basename $i .jpg`_thumb.jpg"
  convert -sample 195x "$i" "`basename $i .jpg`_preview.jpg"
done</code>
    <created-at type="datetime">2009-12-03T05:57:51-08:00</created-at>
    <description>Creates a thumbnail and a preview for each image in a folder</description>
    <id type="integer">170</id>
    <title>Thumbnail Generator and Photo Resizer</title>
    <updated-at type="datetime">2009-12-03T05:57:51-08:00</updated-at>
    <language-string>Bash</language-string>
    <tags type="array">
      <tag>
        <name>shell</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>site = ARGV[0]
raise "Fail." if site.nil? || site == ""
`staticmatic setup #{site}`
Dir.chdir(site)
`wget http://960.gs/files/960_download.zip`
`unzip 960_download.zip`
`rm 960_download.zip`
`mv 960_download/code/css/*.css site/stylesheets`
`rm -rf 960_download`

</code>
    <created-at type="datetime">2009-09-02T18:11:42-07:00</created-at>
    <description></description>
    <id type="integer">169</id>
    <title>Create a StaticMatic site with 960.gs</title>
    <updated-at type="datetime">2009-09-02T18:12:17-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>Ruby</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code># Scans your project for CSS and JS files and 
# runs them through the Yahoo Compression utility
# and then uploads the entire site to your web server via SCP.

# Install prerequisites:

# sudo gem install net-scp

# Download http://www.julienlecomte.net/yuicompressor/
# Create a bin/ folder and place the following files from the download into the folder:
#
# * yuicompressor-2.4.2.jar
# * rhino-1.6R7.jar
# * jargs-1.0.jar

# Configure your settings below and be sure
# to supply the proper path to the Yahoo compressor.  
# Set the COMPRESS flag to false to skip compression

COMPRESS = true
WORKING_DIR = "working"
REMOTE_USER = "foo"
REMOTE_HOST = "foo.org"
REMOTE_PORT = 22
REMOTE_DIR = "/home/#{REMOTE_USER}/#{REMOTE_HOST}/"
LOCAL_DIR = "site"

FILES = ["index.html",
         "faq.html",
         "about.html",
         "contact.html",
         "products",
         "services",
         "stylesheets",
         "images",
         "javascripts"
        ]

COMPRESSOR_CMD = 'java -jar ../bin/yuicompressor-2.4.2.jar'

# DONE CONFIGURING

require 'rubygems'
require 'net/scp'
require 'fileutils'

@errors = [] 
puts "Building page"
`staticmatic build .`
puts "Done building"

Dir.chdir(LOCAL_DIR)
FileUtils.rm_rf WORKING_DIR

puts "Copying working files"
FileUtils.mkdir WORKING_DIR
FILES.each do |f|
  if File.directory?(f)
    FileUtils.cp_r f, WORKING_DIR
  else
    FileUtils.cp f, WORKING_DIR
  end
end

# Upload files in our working directory to the server
def upload(files)
  puts "uploading..."
  Net::SCP.start(REMOTE_HOST, REMOTE_USER, :port =&gt; REMOTE_PORT) do |scp|
   files.each do |file|
     puts "uploading #{file}..."
     if File.directory?(file)
       scp.upload! "working/#{file}",  REMOTE_DIR, :recursive =&gt; true
     else       
       scp.upload! "working/#{file}",  REMOTE_DIR
     end
   end
 end
end


# Minify all CSS and JS files found within the working
# directory
def minify(working_dir)
  files = Dir.glob("#{working_dir}/**/*.{css, js}")
  
  files.each do |file|
    type = File.extname(file) == ".css" ? "css" : "js"
    newfile = file.gsub(".#{type}", ".new.#{type}")
    puts "minifying #{file}"
    `#{COMPRESSOR_CMD} --type #{type} #{file} &gt; #{newfile}`

    if File.size(newfile) &gt; 0
      FileUtils.cp newfile, file
    else
      @errors &lt;&lt; "Unable to process #{file}."
    end
  
  end
end
  
if COMPRESS
  puts "Minifying CSS and JS files"
  minify(WORKING_DIR) 
end

if @errors.length == 0
  puts "Deploying"
  upload(FILES)
else
  puts "Unable to deploy."
  @errors.each{|e| puts e}
end
</code>
    <created-at type="datetime">2009-07-07T20:24:14-07:00</created-at>
    <description>Easily push your StaticMatic-generated site to a remote server. Tested with Dreamhost. 

Optionally compress JS and CSS files to minify them prior to uploading.</description>
    <id type="integer">164</id>
    <title>Compress and upload StaticMatic sites</title>
    <updated-at type="datetime">2009-07-07T20:24:14-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>staticmatic</name>
      </tag>
      <tag>
        <name>Ruby</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Kevin Gisi</author>
    <code>require 'hpricot'

desc "CruiseControl tasks"
task :cruise =&gt; :environment do
  app_name = RAILS_ROOT.split('/').reverse[1]
  report_url = "/app/cruise_control/public/reports/#{app_name}.html"
  begin
    File.open("#{RAILS_ROOT}/config/database.yml",'w'){|f| f.write(
%Q{development:
  adapter: sqlite3
  database: db/development.sqlite3

test:
  adapter: sqlite3
  database: db/test.sqlite3

production:
  adapter: sqlite3
  database: db/production.sqlite3})}
    Rake::Task['db:migrate'].invoke
    report = Rake::Task.task_defined?('report')
    if report
      Rake::Task['report'].invoke
      system("cp #{RAILS_ROOT}/report.html #{report_url}")
    else
      rcov = Rake::Task.task_defined?('test:units:rcov')
      ENV["SHOW_ONLY"] = "m" if rcov
      Rake::Task[rcov ? 'test:units:rcov' : 'test:units'].invoke
      ENV["SHOW_ONLY"] = "c" if rcov
      Rake::Task[rcov ? 'test:functionals:rcov' : 'test:functionals'].invoke
      if rcov
        unit_coverage = open("#{RAILS_ROOT}/coverage/units/index.html"){|f| Hpricot(f)}.at("tt[@class='coverage_code']").inner_html
        functional_coverage = open("#{RAILS_ROOT}/coverage/functionals/index.html"){|f| Hpricot(f)}.at("tt[@class='coverage_code']").inner_html
      end
      File.open(report_url,'w'){|f| f.write(%Q{
&lt;html&gt;
&lt;body&gt;
&lt;h1&gt;
  #{app_name.capitalize}
&lt;/h1&gt;
&lt;p&gt;
  &lt;ul&gt;
    &lt;li&gt;
      Your unit tests passed#{rcov ? " with #{unit_coverage} coverage" : nil}
    &lt;/li&gt;
    &lt;li&gt;
      Your functional tests passed#{rcov ? " with #{functional_coverage} coverage" : nil}
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;
  For a better report, please add the &lt;a href="http://www.snippetstash.com/public/159.txt"&gt;report.rake&lt;/a&gt; file to your application.
&lt;/p&gt;})}
    end
  rescue
    File.open(report_url,'w'){|f| f.write(%Q{
&lt;html&gt;
&lt;body&gt;
&lt;h1&gt;
  #{app_name.capitalize}
&lt;/h1&gt;
&lt;p&gt;
  Your build did not succeed, so no report was generated.
&lt;p&gt;
&lt;/body&gt;
&lt;/html&gt;})}
    raise "Build failed"
  end
end</code>
    <created-at type="datetime">2009-06-17T12:09:16-07:00</created-at>
    <description></description>
    <id type="integer">160</id>
    <title>cruise.rake</title>
    <updated-at type="datetime">2009-06-17T12:09:16-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>Ruby</name>
      </tag>
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>cruisecontrol</name>
      </tag>
      <tag>
        <name>rake</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Kevin Gisi</author>
    <code>require 'hpricot'

APPLICATION = "Saleboard"
APPLICATION_NUMBER="068"
LEAD_DEVELOPER="Kevin Gisi"
PRIMARY_CLIENT="Deb Klossner"

desc "Generate a full report"
task :report =&gt; :environment do
  puts "=== Deployment Report Generator ==="
  puts "Building environment report..."
  report = %Q{
    &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;
          Deployment Checklist
        &lt;/title&gt;
      &lt;/head&gt;
      &lt;style type="text/css" media="all"&gt;
        #content {
          background-color: white;
          width: 800px;
          margin: 20px auto;
          padding: 10px;
          border: 1px solid black;
        }
        td {
          width: 200px;
        }
        #developer_comments {
          height: 350px;
        }
        #client_comments {
          height: 350px;
        }
      &lt;/style&gt;
      &lt;style type="text/css" media="print"&gt;
        #content {
          border: none;
        }
      &lt;/style&gt;
      &lt;body style="background-color: #4B7399"&gt;
        &lt;div id="content"&gt;
          &lt;h1&gt;
            LTS Deployment Checklist
          &lt;/h1&gt;&lt;hr /&gt;
          &lt;p&gt;
            &lt;b&gt;Application: &lt;/b&gt;#{APPLICATION}&lt;br /&gt;
            &lt;b&gt;Application Number: &lt;/b&gt;#{APPLICATION_NUMBER}&lt;br /&gt;
            &lt;b&gt;Lead Developer: &lt;/b&gt;#{LEAD_DEVELOPER}&lt;br /&gt;
            &lt;b&gt;Primary Client: &lt;/b&gt;#{PRIMARY_CLIENT}
          &lt;/p&gt;
          &lt;p&gt;
            &lt;b&gt;Ruby Version: &lt;/b&gt;#{RUBY_VERSION}&lt;br /&gt;
            &lt;b&gt;Rails Version: &lt;/b&gt;#{Rails.version}&lt;br /&gt;
            &lt;b&gt;Report Generated: &lt;/b&gt;#{Time.now.strftime('%B%e, %Y')}
          &lt;/p&gt;
          &lt;hr /&gt;}

  Rake::Task['rcov:full'].invoke

  unit_tests = open("coverage/units/index.html"){|f| Hpricot(f)}
  report += "&lt;h2&gt;Unit Tests&lt;/h2&gt;&lt;table&gt;"
  report += "&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th align='right'&gt;Total Lines&lt;/th&gt;&lt;th align='right'&gt;Lines of Code&lt;/th&gt;&lt;th align='right'&gt;Coverage&lt;/th&gt;&lt;/tr&gt;"
  unit_tests.search("body/table[@class='report']/tbody/tr").each do |row|
    report += "&lt;tr&gt;"
    title = row.at("td")
    report += "&lt;td&gt;&lt;i&gt;#{(link=title.at("a")) ? link.inner_html : title.inner_html}&lt;/i&gt;&lt;/td&gt;"
    report += "&lt;td align='right'&gt;#{row.at("td[@class='lines_total']/tt").inner_html}&lt;/td&gt;"
    report += "&lt;td align='right'&gt;#{row.at("td[@class='lines_code']/tt").inner_html}&lt;/td&gt;"
    report += "&lt;td align='right'&gt;#{row.at("tt[@class='coverage_code']").inner_html}&lt;/td&gt;"
    report += "&lt;/tr&gt;"
  end
  report += "&lt;/table&gt;&lt;hr /&gt;"

  functional_tests = open("coverage/functionals/index.html"){|f| Hpricot(f)}
  report += "&lt;h2&gt;Functional Tests&lt;/h2&gt;&lt;table&gt;"
  report += "&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th align='right'&gt;Total Lines&lt;/th&gt;&lt;th align='right'&gt;Lines of Code&lt;/th&gt;&lt;th align='right'&gt;Coverage&lt;/th&gt;&lt;/tr&gt;"
  functional_tests.search("body/table[@class='report']/tbody/tr").each do |row|
    report += "&lt;tr&gt;"
    title = row.at("td")
    report += "&lt;td&gt;&lt;i&gt;#{(link=title.at("a")) ? link.inner_html : title.inner_html}&lt;/i&gt;&lt;/td&gt;"
    report += "&lt;td align='right'&gt;#{row.at("td[@class='lines_total']/tt").inner_html}&lt;/td&gt;"
    report += "&lt;td align='right'&gt;#{row.at("td[@class='lines_code']/tt").inner_html}&lt;/td&gt;"
    report += "&lt;td align='right'&gt;#{row.at("tt[@class='coverage_code']").inner_html}&lt;/td&gt;"
    report += "&lt;/tr&gt;"
  end
  report += "&lt;/table&gt;&lt;hr /&gt;"

  doc = Hpricot(`cucumber features --format html`)
  doc.search("//div[@class='scenario']").each do |scenario|
    scenario.after %q{
      &lt;div style="text-align: right"&gt;
        Automated Check &lt;input type=checkbox disabled=true checked=#{(scenario.search('li').inject(true){|log,li| log &amp;&amp;= li.attributes['class'] == 'passed'})}&gt;&lt;br /&gt;
        Developer Check &lt;input type=checkbox&gt;&lt;br /&gt;
        Client Check &lt;input type=checkbox&gt;
      &lt;/div&gt;
    }
  end
  report += doc.search("//div[@class='cucumber']").to_html

  report += %Q{
    &lt;h1&gt;Comments&lt;/h1&gt;
    &lt;h2&gt;Developer Comments&lt;/h2&gt;
    &lt;div id="developer_comments"&gt;

    &lt;/div&gt;
    &lt;h2&gt;Client Comments&lt;/h2&gt;
    &lt;div id="client_comments"&gt;
    
    &lt;/div&gt;
    &lt;h1&gt;Deployment&lt;/h1&gt;
    &lt;p&gt;
      Once this application is deployed, LTS-Web Development will provide bug-fixes for requests submitted within two weeks of deployment. Any issues with the application beyond the two-week window may either be immediately fixed - at the discretion of LTS-Web Development - or added as features to a new project request. Any additional features required after deployment will be added as requirements for a new project request, so as to ensure fair distribution of resources to application requests.
    &lt;/p&gt;
    &lt;p&gt;
      I understand the deployment policies, and request this application be deployed at the earliest possible time.
    &lt;/p&gt;
    &lt;p&gt;
      &lt;u&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/u&gt;   Date: &lt;u&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/u&gt;
    &lt;/p&gt;
  }

  report += %q{
      &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;}
  File.open('report.html','w'){|f| f.write(report)}
  puts "Final report written to report.html"
end</code>
    <created-at type="datetime">2009-06-17T11:19:50-07:00</created-at>
    <description></description>
    <id type="integer">159</id>
    <title>Report.rake</title>
    <updated-at type="datetime">2009-06-17T11:19:50-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>rake</name>
      </tag>
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>Ruby</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Kevin Gisi</author>
    <code>function Cat(){

}

Cat.meow = function() {
  return "meow";
};

Cat.lol = function() {
  return "I can haz";
}

Screw.Unit(function() {
  describe("The stubbing process",function(){
    it("--- well, 0 equals 0",function(){
      expect(0).to(equal,0);
    });
  });
  describe("Cats",function(){
    describe("lol method",function(){
      it("should return 'I can haz'",function(){
        expect(Cat.lol()).to(equal,"I can haz");
      });
    });
    describe("meow method",function(){
      it("should return 'meow'",function(){
        expect(Cat.meow()).to(equal,"meow");
      });
      describe("when stubbed",function(){
        before(function(){
          stubbedCat = Smoke.Mock(Cat);
          stubbedCat.should_receive('meow').and_return("woof");
        });
        it("should return 'woof'",function(){
          expect(stubbedCat.meow()).to(equal,"woof");
          Smoke.checkExpectations();
        });
        it("should not affect lol method",function(){
          expect(Cat.lol()).to(equal,"I can haz");
        });
      });
    });
  });
});
</code>
    <created-at type="datetime">2009-06-16T01:30:53-07:00</created-at>
    <description></description>
    <id type="integer">157</id>
    <title>Screw.Unit and Smoke Example</title>
    <updated-at type="datetime">2009-06-16T01:30:53-07:00</updated-at>
    <language-string>JavaScript</language-string>
    <tags type="array">
      <tag>
        <name>ScrewUnit</name>
      </tag>
      <tag>
        <name>Javascript</name>
      </tag>
      <tag>
        <name>Smoke</name>
      </tag>
      <tag>
        <name>Testing</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>Event.observe(window, "load", function(){
    
    var top_nav_lis = $$("#navbar ul li");
    top_nav_lis.each(function(li){
      li.style.width = (100/top_nav_lis.length + '%');
      li.style.textAlign = "center";
    })

  }

)
</code>
    <created-at type="datetime">2009-06-09T08:43:11-07:00</created-at>
    <description>This is the code used on SnippetStash to center the top menu horizontally.</description>
    <id type="integer">156</id>
    <title>Center-aligned menu with JS</title>
    <updated-at type="datetime">2009-06-09T08:43:11-07:00</updated-at>
    <language-string>JavaScript</language-string>
    <tags type="array">
      <tag>
        <name>Prototype</name>
      </tag>
      <tag>
        <name>Javascript</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Kevin Gisi</author>
    <code>def update
  formats = ["html","xml","js"]
  respond_to do |f|
    self.send("update_#{response[0]}") unless (response=formats.select{|x| f.send(x)}).empty?
  end
end</code>
    <created-at type="datetime">2009-06-02T12:22:56-07:00</created-at>
    <description></description>
    <id type="integer">154</id>
    <title>Respond_to Hack</title>
    <updated-at type="datetime">2009-06-02T12:25:08-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>respond_to</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Marty Andrews</author>
    <code>require 'flog'
require 'flay'
require 'roodi'
require 'roodi_task'
require 'metric_fu'

desc "Analyze for code complexity"
task :flog do
  flog = Flog.new
  flog.flog_files ['app']
  threshold = 40

  bad_methods = flog.totals.select do |name, score|
    score &gt; threshold
  end
  bad_methods.sort { |a,b| a[1] &lt;=&gt; b[1] }.each do |name, score|
    puts "%8.1f: %s" % [score, name]
  end
  
  raise "#{bad_methods.size} methods have a flog complexity &gt; #{threshold}" unless bad_methods.empty?
end

desc "Analyze for code duplication"
task :flay do
  threshold = 25
  flay = Flay.new({:fuzzy =&gt; false, :verbose =&gt; false, :mass =&gt; threshold})
  flay.process(*Flay.expand_dirs_to_files(['app']))

  flay.report

  raise "#{flay.masses.size} chunks of code have a duplicate mass &gt; #{threshold}" unless flay.masses.empty?
end

RoodiTask.new 'roodi', ['app/**/*.rb'], 'roodi.yml'

task :quality =&gt; [:flog, :flay, :roodi, 'metrics:all']</code>
    <created-at type="datetime">2009-06-02T11:29:08-07:00</created-at>
    <description></description>
    <id type="integer">153</id>
    <title>Quality.rake</title>
    <updated-at type="datetime">2009-06-02T11:29:08-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>rake</name>
      </tag>
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>test</name>
      </tag>
      <tag>
        <name>Flog</name>
      </tag>
      <tag>
        <name>Flay</name>
      </tag>
      <tag>
        <name>Roodi</name>
      </tag>
      <tag>
        <name>Metric_fu</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Brian Hogan</author>
    <code>sudo -i
defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture '/Library/Desktop\ Pictures/ruby.jpg' </code>
    <created-at type="datetime">2009-05-19T09:39:25-07:00</created-at>
    <description>Quick way to change the background login on OSX. I used the wallpaper from here:

http://www.rubyinside.com/advent2006/wallpaper1920.jpg


</description>
    <id type="integer">152</id>
    <title>Change Mac login screen wallpaper</title>
    <updated-at type="datetime">2009-05-19T09:39:25-07:00</updated-at>
    <language-string>Bash</language-string>
    <tags type="array">
      <tag>
        <name>mac</name>
      </tag>
      <tag>
        <name>osx</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author></author>
    <code>class ToHaml
  def initialize(path)
    @path = path
  end
  
  def convert!
    Dir["#{@path}/**/*.erb"].each do |file|
      `html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
    end
  end
end

path = File.join(File.dirname(__FILE__), 'app', 'views')
ToHaml.new(path).convert!
</code>
    <created-at type="datetime">2009-05-14T18:17:07-07:00</created-at>
    <description>Convert your ERB views to HAML with this simple ruby script. Originally found at http://snippets.dzone.com/posts/show/6838
</description>
    <id type="integer">151</id>
    <title>Convert ERB views to HAML</title>
    <updated-at type="datetime">2009-05-14T18:17:07-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>Ruby</name>
      </tag>
      <tag>
        <name>haml</name>
      </tag>
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>erb</name>
      </tag>
    </tags>
  </snippet>
  <snippet>
    <author>Kevin Gisi</author>
    <code>&lt;% form_remote_tag :url =&gt; whatever, :before =&gt; "tinyMCE.triggerSave(true,true)" do %&gt;
   &lt;%= text_area :object, :method, :class =&gt; "mceEditor" %&gt;
   &lt;%= submit_tag "save" %&gt;
&lt;% end %&gt;</code>
    <created-at type="datetime">2009-04-21T13:24:36-07:00</created-at>
    <description>In order to get TinyMCE to work with Ajax calls, you need to tell the plugin to save the contents prior to making the post. This code demonstrates how you would do that.</description>
    <id type="integer">150</id>
    <title>TinyMCE with Ajax in Rails</title>
    <updated-at type="datetime">2009-04-21T13:24:36-07:00</updated-at>
    <language-string>Ruby</language-string>
    <tags type="array">
      <tag>
        <name>TinyMCE</name>
      </tag>
      <tag>
        <name>Rails</name>
      </tag>
      <tag>
        <name>Ajax</name>
      </tag>
    </tags>
  </snippet>
</snippets>
