This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To install ruby-debug on Ubuntu ruby-1.9.3 you need to download from http://rubyforge.org/frs/?group_id=8883 | |
linecache19-0.5.13.gem | |
ruby_core_source-0.1.5.gem | |
ruby-debug19-0.11.6.gem | |
ruby-debug-base19-0.11.26.gem | |
#Then in your console | |
export RVM_SRC=/your/path/to/ruby-1.9.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def diff t2, t1 | |
nsec = t2.nsec - t1.nsec | |
sec = (t2 - t2.nsec) - (t1 - t1.nsec) | |
sec + nsec | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://gist.github.com/gists/f5f20c1d973dd6c3ebdb/download | tar -xO | ruby -- - "`ruby -e 'require "pp"; pp (1..1000).to_a.shuffle'`" :desk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
def merge_sort(array,dir = :ask) | |
pp array if $VERBOSE | |
raise ArgumentError, "direction must be :ask or :desk symbol" unless [:ask,:desk].include? dir | |
return array if array.count == 1 | |
array.reverse! | |
middle = array.count / 2 | |
right, left = array[0...middle].reverse, array[middle..-1].reverse | |
pp [left,right] if $VERBOSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for pid in $(ps ax | grep unicorn | grep -v grep | awk '{ print $1 }'); do sudo kill -9 $pid; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls db/migrate | grep `rake db:version | egrep -o '\w+$'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake db:migrate && rake db:rollback && rake db:migrate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ActionView::Helpers::FormOptionsHelper |
OlderNewer