Use <meter> for diff percentages in snapshot thumbnails

I felt like these diff percentages weren't very useful when viewing a
bunch of snapshot thumbnails. I never looked at the numbers, so I wasn't
getting very much benefit from their existence. I'd like to make this
information more consumable, so I am replacing the text with a more
visual representation. I decided to use the <meter> element and styled
it to match the rest of the app.

I chose the values of low and high fairly arbitrarily, so we'll see how
things shake out as we get accustomed to seeing this information
presented in this way.

I have the concern that people will not understand what this meter
represents, but I think we could also add it to the snapshot page itself
where it could be presented next to the actual numerical value, to help
build a connection.

I am also worried that we now have too many bar-like elements floating
around, and that may get confusing as to what they actually mean. I
think we can probably resolve this with the correct styling over time,
so I am not going to worry about it too much.

Change-Id: I684ab42e4ce96e897ac4f1b8e36e851f8fd0f1f8
Add friendly intro jumbotron to main page

When people first set up Diffux, they were previously presented with a
more or less blank page. While this worked, it wasn't very friendly. I'd
like to start people off on the right foot, so if they don't have any
projects yet, I think it would be nice to show a friendly message
welcoming them to the app and gives them a link to help encourage
contributions.

The copy that I wrote is just a pretty rough first draft, but I figured
it was better than what we had before, so I'm shipping it.

Change-Id: I97e5241497d82dc435591a5cd9a7a7923d8b7988
Merge pull request #84 from paradasia/master

Add animation to sweep progress bars with bootstrap class. Resolves #77.
Remove redundant `#update_counters!`

When snapshots for a sweep change, we call `Sweep#refresh!` to update
counters and perhaps send out an email if the sweep is done. In the code
that sends out the email, there was a redundant call to update the
counters again. This might be the reason to bug #83. I've removed the
redundant call and updated specs to be more like the live code - instead
of calling private methods directly, we call `#refresh!`.

There are a couple of redundant saves here too that I'm investigating
next.
Remove redundant `Sweep#save!`

When we were refreshing a sweep, we saved the sweep twice: once in
`#update_counters!` and once in `#send_email_if_needed!`. Since these
two actions are always combined in the `#refresh!` method, we don't have
to save more than one time.
Lock `Sweep#refresh!` to one thread at a time

A couple of bugs are indicating that there's a lot of race issues in
this method. My recent two commits have probably made it less likely
for these to happen but I wanted to follow up with something that has a
better potential of getting rid of the problem altogether.

I'm using a pessimistic block (`with_block`) to lock multiple threads
from calling `#refresh!` at once. I was first going to use a local
mutex, but since it is very likely that workers are run on more than one
machine, this wasn't going to scale. A database level lock should be
more robust and is exactly what `with_lock` gives us.

More on pessimistic locking:
http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html
Make pending snapshots part of the sweep progress bar

Before, the progress bar wouldn't start showing anything interesting
until the first snapshot image had been taken. After this commit, it
will immediately go entirely gray and become active. I made this happen
by putting the pending count last in the list of stacked progress bars,
and changed the background color to gray. It now looks like the progress
bar is in an indeterminate state to begin with, which is better in my
opinion.
Fix rubocop lints and refactor `#sweep_progress_bar`

I had introduced some lints here before that I wanted to fix. These are
the changes I made:

- Changed from `#inject` to `#reduce`
- Fixed wrong indentation in one place
- Reordered some things for better readability
- Removed unnecessary guard for division by zero

Plus some other minor changes.
Change order of link to before and after image

These were in the wrong natural order. In all other places, the before
image is ordered before the after image.
Move diff UI to its own partial

The main snapshots/show haml file was getting hard to read. By moving
the details of the diff UI to its own partial, we make it easier to add
stuff to the main haml file.
Always show the snapshot image on the snapshot#show page

A recent commit (8b94b558094) removed the before and after image from
the snapshot#show page. This was a win in case the snapshot was in a
state where it had a non-zero diff because we saved a lot of space by
not rendering the before and after images. However, when the snapshot
had a zero diff and when it didn't have a baseline to compare against,
you wouldn't see the snapshot image at all.

I added the image back in two places. I also added an alert to explain
the state when there is no baseline to compare against.

The spec coverage for all of this is not great. But I did add some smoke
tests just to make sure that the page would render with snapshots in
different states. And while doing that I found a bug in the snapshot
factory that I fixed.
Fix off-by-one error in snapshot_diff_cluster.rb

We were off by one pixel when calculating percentages in this file. As
pointed out by @lencioni in 1474692316688b3913.

I had to wrap my head around this issue once or twice (pun intended).
The off-by-one was obvious, but constructing the specs in a way that
made sense was harder than I thought.

This closes #80.
Add keyboard shortcut help modal

To make it easier for new people to learn about the different keyboard
shortcuts we have, I'm adding a popup modal that documents them all. You
can access the modal by hitting `?`. I've added a line to the about page
with information about it.

This closes #78.
Fix failing snapshots_controller_spec

I added a help modal for keyboard shortcuts that made specs fail for the
snapshots controller. The specs weren't specific enough so some of them
picked up copy from the help modal and started failing. I fixed the bug
by being more precise in the specs (looking for elements with a certain
class instead of copy on the page).

To make testing easier by having access to a `have_css` matcher, I added
capybara to the list of test dependencies.
Replace <code> with <kbd> on /about

<kbd> is the correct element for this piece of content.

Change-Id: I7799f90f0e7c637f39d7788c252ad2ccf93472b0
Add paragraph about keyboard shortcuts to new app intro

When people first set up Diffux, they will be presented with some
welcome text to help get them situated. Since we now have a modal that
shows you what keyboard shortcuts are available, it is nice to point
this out to new users at this time.

Change-Id: I36172fb5c9aa741bf4b267bc8486c280d4eb20a4
Don't send email when email address is empty

We noticed that the sweep progress bar stopped updating after a while.
By running `sweep.refresh!` manually we noticed that the code was
failing due to the email address being an empty string. This commit
mitigates that by changing the condition in where we return from the
`send_email_if_needed!` method in case the email is missing.

This fixes issue #87.
Delete unused cloudinary config file

We removed the dependency to Cloudinary in
a8038c1866d55d1db31a48d38cf5bdd14873a36a but forgot to remove this file.
Remove config/database.yml from git repo

I'm planning on making this a .gitignore file and allowing people to
configure their own version of this file instead.
Add config/database.yml to .gitignore

We want to force people to specify their own database config, so I'm
making this a non-indexed file. A subsequent commit will add an example
configuration as config/database.yml.example.