This file contains 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 calculate_till | |
self.cash_in_till = type.nil? ? cash_on_hand : | |
send("calculate_#{type.gsub(/-/,"_")}") | |
calculated_value | |
end |
This file contains 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 'lib/my_gem' | |
#http://stackoverflow.com/questions/4493114/developing-gems-and-testing | |
#http://stackoverflow.com/questions/4487948/how-can-i-specify-a-local-gem-in-my-gemfile |
This file contains 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
gem build hola.gemspec |
This file contains 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
# https://github.com/fholgado/minibufexpl.vim | |
# ':edit' --> to open another file in vim and creating a new buffer | |
# ':new' --> to open another file in vim and creating an empty | |
# ':b2' --> to open a buffer with label '2' | |
# Commnad ':MBEbd', ':MBEbw' or ':MBEbun' could be used to delete/wipeout/unload buffers just as ':bd', ':bw' or ':bun', but the window that previously holding them will be preserved. |
This file contains 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 'spec_helper' | |
describe "Searching" do | |
before(:each) do | |
visit root_path | |
end | |
before(:all) do | |
load_test_posts | |
end |
This file contains 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
#Testing my full-text-search function. I do not have a submit button to submit my #query field but instead I only have the enter key press for it. | |
describe "will be successful" do | |
it "after the #query field is submitted by return button and the relevance of the value in the #query search_field_input is > 0%" do | |
result = Post.text_search(@question.title) | |
#fill_in 'query', with: "#{@question.title}\n" | |
Post.should_receive(:text_search).at_least(:once){ result } | |
visit root_path | |
page.should have_content @question.title | |
page.should have_css(".post-row", count: 1) |
This file contains 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
%li{:class => "#{'active' if current_page?(root_path)}"}=link_to "Home", root_path |
This file contains 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
find -wholename '*spec.rb' | xargs sed -i 's/shared.navbar.sign_in_with_fb_link.sign_in_with_facebook/shared.navbar.user_links.sign_in_with_fb_link.sign_in_with_facebook/g | |
find -wholename '*[rb][haml]&' | xargs sed -i 's/status_circle/status_indicator/g' |
This file contains 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
#i.e you have Question object that has parent class Post | |
#say for example Post::SomeMethod returns true by default | |
@question = Question.create | |
#will fail | |
Post.any_instance.should_receive(:some_method).and_return false | |
@question.some_method.should eq false |
This file contains 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
//Assume that the code base is really large. Say thousands of files. And you wanted to write on files involved to http://www.some.domain.com/membership/index.php | |
//This would be useful | |
find -name "index.htm" | ack-grep "membership" | |
find -name "index.php" | ack-grep "membership" | |
//Apply reg expressions to be more effective |
OlderNewer