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
... | |
# ==> Configuration for any authentication mechanism | |
# Configure which keys are used when authenticating a user. The default is | |
# just :email. You can configure it to use [:username, :subdomain], so for | |
# authenticating a user, both parameters are required. Remember that those | |
# parameters are used only when authenticating and not when retrieving from | |
# session. If you need permissions, you should implement that in a before filter. | |
# You can also supply a hash where the value is a boolean determining whether | |
# or not authentication should be aborted when the value is not present. | |
config.authentication_keys = [ :login ] |
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
# before filter for api controller | |
def verify_authenticity_token | |
@current_user = User.find_by_authentication_token(params[:auth_token]) | |
render status: 401, json: { message: '...' } and return unless @current_user | |
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
module AccountSupport::CacheManager | |
extend ActiveSupport::Concern | |
included do | |
# Returns the cached users of an account | |
def cached_users | |
Rails.cache.fetch("#{id}_account.users") { member_users.all } | |
end | |
# Returns the cached teammates of an account |
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
function createPerson(name){ | |
var localPerson = new Object(); | |
localPerson.name = name; | |
return localPerson; | |
} | |
var globalPerson = createPerson("Nicholas"); | |
// do something with globalPerson |
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. Open ~/.bash_profile | |
2. copy and paste LC_CTYPE="utf-8" | |
3. Execute mailcatcher |
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
Show hidden characters
// While you can edit this file, it's best to put your changes in | |
// "User/Preferences.sublime-settings", which overrides the settings in here. | |
// | |
// Settings may also be placed in file type specific options files, for | |
// example, in Packages/Python/Python.sublime-settings for python files. | |
{ | |
// Sets the colors used within the text area | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
// Note that the font_face and font_size are overriden in the platform |
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
function ReflectValueOnKeyUp(from, to, options) { | |
var options = options || {}; | |
var escape_string = options.escape_string || false; | |
$(from).keyup(function(){ | |
var that = $(this); | |
if (options.escape_string == true) { | |
$(to).val(escapeString(that.val())); | |
} else { | |
$(to).val(that.val()); | |
} |
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 AccountDeletionJob | |
@queue = :account_deletion | |
# Warning .perform will destroy an account from the database. | |
def self.perform(account_id) | |
account = Account.find(account_id) | |
if account | |
Account.transaction do | |
begin | |
account.destroy! | |
AccountAlertMailer.deletion_notification(account).deliver |
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_relative '../../app/services/recurly_account_checker' | |
require 'recurly' | |
describe RecurlyAccountChecker do | |
let(:user) { stub } | |
let(:customer) { stub } | |
let(:customer_id) { -1 } | |
before do | |
user.stub(:customer_id) { customer_id } | |
Recurly::Account.stub(:find) { customer } | |
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 delayed_deletion | |
begin | |
Account.transaction do | |
update_column(:deleted_at, Date.current) | |
destroy_subscription | |
end | |
rescue Exception; end; | |
AccountAlertMailer.deletion_notification(admin).deliver | |
end |
NewerOlder