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
<link rel="apple-touch-icon" href="img/apple-touch-icon.png"> <!-- 57x57 --> | |
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png"> | |
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png"> |
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
#via rubyquicktips | |
AfterStep('@pause') do | |
print "Press Return to continue..." | |
STDIN.getc | |
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
def find_frequency(sentence, word) | |
sentence.downcase.split.count(word.downcase) | |
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
def sort_string(string) | |
string.split(' ').sort{|x, y| x.length <=> y.length}.join(' ') | |
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
def adapter_for(message) | |
protocol = message.to.scheme.downcase | |
adapter_name = "#{protocol.capitalize}Adapter" | |
adapter_class = self.class.const_get(adapter_name) | |
adapter_class.new | |
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
suits = %w{s h d c} | |
ranks = %w{2 3 4 5 6 7 8 9 T J Q K A} | |
deck = suits.product(ranks) | |
def pull_card | |
deck.sample | |
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
# expand selection to word, create new selection | |
cmd + d | |
# skip over a match | |
cmd + k, d | |
# expand selection to all matches | |
cmd + ctrl + g |
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
# assuming your subject is the UsersController with a method user_params | |
describe UsersController do | |
describe "params" do | |
# per default the matcher extracts the subject and params method | |
it { should permit_params(:email, :name, :role) } | |
# to overwrite the params method use explicit .params_method() | |
it { should permit_params(:first_name, :last_name).params_method(:other_user_params) } | |
OlderNewer