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
{ | |
"openssl_packages" : [ | |
"openssl-1.0.2k-8.el7.x86_64", | |
"openssl-libs-1.0.2k-8.el7.x86_64" | |
], | |
"name" : "cluster124-shard-00-00-iluv4.mmscloudteam.com", | |
"heracles_version" : "3aa10a7d1bb2a11aeeba7f51ad61cd94fcf759c7", | |
"chef_last_successful_run" : 1513938607, | |
"chef_repo_revision" : "87339f3a5b41314acee26445c92b7c5a15f075f9", | |
"chef_version" : "12.21.3" |
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
include stdio.h |
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 is_int(s): | |
try: | |
int(str(s)) | |
return True | |
except ValueError: | |
return 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
# 1. In views/mailer, for each whatever.html.erb template file create a corresponding whatever.sms.erb file. It will automatically have access to all the same template variables that are available in the HTML file. | |
# 2. In the mail method in mailer.rb replace the line "super headers" with something like | |
if you_want_to_send_via_SMS | |
sms_body = render :file => "mailer/#{action_name}.sms.erb", :layout => false | |
# Post to Kanel | |
else | |
super headers | |
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
def match_loans(basket) | |
match_basket = nil | |
total_spent = 0 | |
match_user = # LOAD UP THE MATCHING ACCOUNT | |
basket.basket_items.each do |item| | |
loan = item.purchasable | |
# If this loan qualifies for matching and |
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
# spec/support/example_helpers.rb | |
module ExampleHelpers | |
module CachingTestHelpers | |
ActionController::Base.public_class_method :page_cache_path | |
module ResponseHelper | |
def action_cached?(request) | |
request.path.is_action_cached? | |
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
#spec/requests/cache_book_spec.rb | |
require 'spec_helper' | |
describe "CacheBook" do | |
# Turn on caching | |
before do | |
ActionController::Base.perform_caching = true | |
ActionController::Base.cache_store = :file_store, "tmp/cache" | |
FileUtils.rm_rf(Dir['tmp/cache']) |
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
#spec/requests/cache_home_spec.rb | |
require 'spec_helper' | |
describe "CacheHome" do | |
# Enable caching, just for the duration of this test | |
# Clear the cache | |
before do | |
@user = FactoryGirl.create(:user) | |
ActionController::Base.perform_caching = true |
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
config.active_record.observers = :books_sweepers |
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
class BookSweeper < ActionController::Caching::Sweeper | |
observe Book | |
def after_update(book) | |
expire_cache_for(book) | |
end | |
def after_books_share | |
book = Book.find params[:id] | |
expire_cache_for(book) |
NewerOlder