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
# Example | |
# | |
# | |
#<div class="cached-async-render" | |
# data-url="/my_dynamic_template.html" | |
# data-cache-key="foo-user" | |
# data-cache-expires-in="120" | |
# data-success-callback="initializeThings()"> | |
# loading... | |
#</div> |
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 set_local_current_account | |
return if current_user.nil? | |
measure 'set_local_current_account' do | |
padma_cur_acc = current_user.padma(!params[:refresh_current_account]).try(:current_account_name) | |
local_cur_acc = current_user.account_name | |
if padma_cur_acc && padma_cur_acc != local_cur_acc | |
current_user.current_account = Account.find_or_create_by_name(padma_cur_acc) | |
current_user.save | |
end | |
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
PadmaContact.timeout = 30000 | |
contacts = PadmaContact.paginate contacts_ws_params |
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
before_save :set_key | |
def set_key | |
self.key = self.name.gsub('-','_').parameterize('_') if self.name.present? | |
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
$.gritter.add({title: '<%= "#{attribute} #{I18n.t("errors.messages.invalid")}" %>', text:("<%= errors_array.to_s %>")}); |
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
class ThisClass | |
def a_method | |
"checking out gist in android" | |
end | |
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
MyClass.stub(:metho_name) do |arg1, arg2| | |
"return-value-using-#{arg1}-#{arg2}-values" | |
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
@account = FactoryGirl.create(:account) | |
PadmaAccount.stub!(:find).and_return(PadmaAccount.new(name: @account.name, enabled: true)) | |
@user = FactoryGirl.create(:user) | |
pu = PadmaUser.new(username: @user.username) | |
User.any_instance.stub(:padma_enabled?).and_return true | |
User.any_instance.stub(:padma).and_return pu | |
sign_in(@user) |