Please see: https://github.com/kevinSuttle/html-meta-tags, thanks for the idea @dandv!
Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| # RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
| # defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
| module Player | |
| describe MovieList, "with optional description" do | |
| it "is pending example, so that you can write ones quickly" | |
| it "is already working example that we want to suspend from failing temporarily" do | |
| pending("working on another feature that temporarily breaks this one") |
| require 'cgi' | |
| require 'digest/md5' | |
| require 'net/https' | |
| require 'uri' | |
| module Jekyll | |
| class GistTag < Liquid::Tag | |
| def initialize(tag_name, text, token) | |
| super | |
| @text = text |
| // Python equivalent: | |
| // string[start:end] | |
| function tt_str_slice($string, $start=NULL, $end=NULL) { | |
| $length = strlen($string); | |
| if ($start === NULL) { | |
| $start = 0; | |
| } else if ($start < 0) { | |
| $start = $length + $start; | |
| if ($start < 0) { |
| # Jekyll archive page generator with pagination. | |
| # | |
| # Based on the category generator from | |
| # http://recursive-design.com/projects/jekyll-plugins/, | |
| # which is copyright (c) 2010 Dave Perrett, | |
| # http://recursive-design.com/ and is licensed under the MIT | |
| # license (http://www.opensource.org/licenses/mit-license.php), and | |
| # on the pagination code from Jekyll itself. | |
| # | |
| # This code is copyright (c) 2011 Benjamin Curtis, and is licensed |
| # NOTE - I do not support this code anymore. | |
| # You should use plambjet version @ https://gist.github.com/pjambet/5229322 | |
| # | |
| # Based on https://gist.github.com/1182136 and https://gist.github.com/1586384 | |
| # Make the will_paginate generate markup for Zurb Foundation | |
| # Put this in config/initializers/foundation_paginate.rb | |
| module WillPaginate | |
| module ViewHelpers | |
| class LinkRenderer < LinkRendererBase | |
| protected |
| require 'RMagick' | |
| TOP_N = 10 # Number of swatches | |
| # Create a 1-row image that has a column for every color in the quantized | |
| # image. The columns are sorted decreasing frequency of appearance in the | |
| # quantized image. | |
| def sort_by_decreasing_frequency(img) | |
| hist = img.color_histogram | |
| # sort by decreasing frequency |
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |