Skip to content

Instantly share code, notes, and snippets.

View LucasArruda's full-sized avatar
🎯
Focusing

Lucas Arruda LucasArruda

🎯
Focusing
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
@mattwynne
mattwynne / be_same_file_as.rb
Last active May 21, 2022 13:27
RSpec matcher to compare two file, using their MD5 hashes
RSpec::Matchers.define(:be_same_file_as) do |exected_file_path|
match do |actual_file_path|
expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path))
end
def md5_hash(file_path)
Digest::MD5.hexdigest(File.read(file_path))
end
end
@sohara
sohara / table cell locator.rb
Created February 2, 2011 18:48
step definition to test the contents of specific table row given a column heading and the contents of one of the cells in the row
# Locates a table cell based on given row and column content.
When /^(.*) in the "([^\"]*)" column of the "([^\"]*)" row$/ do |action, column_title, row_title|
col_number = 0
all(:xpath, "//*[(th|td)/descendant-or-self::*[contains(text(), '#{column_title}')]]/th").each do |element|
col_number += 1
break if element.has_content?(column_title)
end
within :xpath, "//*[(th|td)/descendant-or-self::*[contains(text(), '#{row_title}')]]/td[#{col_number}]" do
When action
end
@johngibb
johngibb / install-git-completion.sh
Last active August 10, 2022 04:42
Mac OS X - Install Git Completion
URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@nileshtrivedi
nileshtrivedi / hash_builder.rb
Created November 24, 2011 17:49 — forked from brentd/gist:360506
HashBuilder allows you to build a Hash in Ruby similar to Builder with some enhancements
# Allows you to build a Hash in a fashion very similar to Builder. Example:
# Fork of https://gist.github.com/360506 by BrentD with some enhancements
#
# HashBuilder.build! do |h|
# h.name "Nilesh"
# h.skill "Ruby"
# h.skill "Rails" # multiple calls of the same method will collect the values in an array
# h.location "Udaipur, India" do # If a block is given, first argument will be set as value for :name
# h.location do
# h.longitude 24.57
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.3-p0@railsapp"
#
# Uncomment following line if you want options to be set only for given project.
@mattfinlayson
mattfinlayson / gist:1530870
Created December 29, 2011 01:01
iconv errors running jekyll on os x
rake generate
## Generating Site with Jekyll
directory source/stylesheets/
create source/stylesheets/screen.css
/Users/BLARG/.rvm/gems/ruby-1.9.2-p290/gems/maruku-0.6.0/lib/maruku/input/parse_doc.rb:22:in `require': no such file to load -- iconv (LoadError)
from /Users/BLARG/.rvm/gems/ruby-1.9.2-p290/gems/maruku-0.6.0/lib/maruku/input/parse_doc.rb:22:in `<top (required)>'
from /Users/BLARG/.rvm/gems/ruby-1.9.2-p290/gems/maruku-0.6.0/lib/maruku.rb:85:in `require'
from /Users/BLARG/.rvm/gems/ruby-1.9.2-p290/gems/maruku-0.6.0/lib/maruku.rb:85:in `<top (required)>'
from /Users/BLARG/.rvm/gems/ruby-1.9.2-p290/gems/jekyll-0.11.0/lib/jekyll.rb:26:in `require'
from /Users/BLARG/.rvm/gems/ruby-1.9.2-p290/gems/jekyll-0.11.0/lib/jekyll.rb:26:in `<top (required)>'
@klauswuestefeld
klauswuestefeld / gist:1595701
Created January 11, 2012 17:22
O Ciclo Vicioso Do Software Retranqueiro
We couldn’t find that file to show.
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions: