- Amex Card:
^3[47][0-9]{13}$
- BCGlobal:
^(6541|6556)[0-9]{12}$
- Carte Blanche Card:
^389[0-9]{11}$
- Diners Club Card:
^3(?:0[0-5]|[68][0-9])[0-9]{11}$
- Discover Card:
^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$
- Insta Payment Card:
^63[7-9][0-9]{13}$
- JCB Card:
^(?:2131|1800|35\d{3})\d{11}$
- KoreanLocalCard:
^9[0-9]{15}$
_bundler_complete() | |
{ | |
if [[ ! `which bundle` ]]; then | |
return | |
fi | |
local cur prev commands | |
commands="help install update package exec config check list show outdated console open viz init gem platform" | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
namespace :workers do | |
namespace :clockwork do | |
desc "Stop clockwork" | |
task :stop do | |
on roles(:app) do | |
within release_path do | |
with rails_env: fetch(:rails_env) do | |
execute :bundle, :exec, :clockworkd, "-c lib/clockwork.rb --pid-dir=#{cw_pid_dir} --log-dir=#{cw_log_dir} stop" | |
end | |
end |
-
Zero downtime during upgrades and scaling out system (such as zero seconds downtime, while app still runs)
-
Highly Scalable with Terabytes of data with high performance and low cost with shards
-
Automatic Replica Set member take-over in case of failing primary, with automatic recovery for returning hosts.
-
Automatic promotion to primary and de promotion for any member of a replica set based on performance and latency.
-
Journaling, allows safe recovery in case of hard-disk failure.
-
Strong consistency, "Afford to loose data" in mongoDB is myth. Data is not lost, it's only not persisted due to failures on the developers code.
-
When Sharding is not feasible, different Documents (rails models) can be on different Replica sets (different database or set) altogether, since there are no joins in Mongo.
-
Background indexes.
## mysql::master | |
ruby_block "store_mysql_master_status" do | |
block do | |
node.set[:mysql][:master] = true | |
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password]) | |
m.query("show master status") do |row| | |
row.each_hash do |h| | |
node.set[:mysql][:master_file] = h['File'] | |
node.set[:mysql][:master_position] = h['Position'] | |
end |
#app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
def opensearch | |
response.headers['Content-Type'] = 'application/opensearchdescription+xml; charset=utf-8' | |
end |
# app/models/post.rb | |
class Post | |
searchable :auto_index => false, :auto_remove => false do | |
text :title | |
text :body | |
end | |
after_commit :resque_solr_update |
# First configure your models to use Amazon s3 as storage option and setup the associated S3 config. | |
# Then add the classes your want to migrate in the klasses array below. | |
# Then run rake paperclip_migration:migrate_to_s3 | |
# Should work but this is untested and may need some tweaking - but it did the job for me. | |
namespace :paperclip_migration do | |
desc "migrate files from filesystem to s3" | |
task :migrate_to_s3 => :environment do | |
klasses = [:model_1, :model_2] # Replace with your real model names. If anyone wants to this could be picked up from args or from configuration. | |
klasses.each do |klass_key| |