Skip to content

Instantly share code, notes, and snippets.

@plasticine
plasticine / SCSS Sprite based nav.scss
Created May 9, 2011 01:43
Generates all the required classes, hover states and image offsets for sprite-based navigation.
@function sprite-ify($items, $height, $img, $offset:0){
display:block;
height:$height;
text-indent:-9999px;
background-color:transparent;
background-image:url($img);
@for $index from 1 through length($items) {
$item: nth($items, $index);
@if $index > 1 { $offset: $offset - nth(nth($items, $index - 1), 2); }
&.#{nth($item, 1)} {
@juliocesar
juliocesar / testing_front_end_rspec_capybara.md
Created October 21, 2010 23:51
Testing front-end for a Sinatra app with RSpec and Capybara

Testing front-end for a Sinatra app with RSpec and Capybara

I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.

A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.

So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.

Gemfile

## Juggle
#
# The refined way of combining gathering client-side javascripts.
#
# usage:
# (in your Rakefile)
#
# require './lib/juggle'
# Juggle.file 'public/app.js' => 'public/libs.js' do
# curl 'http://github.com/documentcloud/underscore/raw/1.1.1/underscore.js'
@paulirish
paulirish / README.md
Created January 4, 2010 02:38
imagesLoaded() jquery plugin