Bin e padrões para validação de cartão de crédito.
| Bandeira | Começa com | Máximo de número | Máximo de número cvc |
|---|---|---|---|
| Visa | 4 | 13,16 | 3 |
| Mastercard | 5 | 16 | 3 |
| # views/fields/belongs_to_scoped/_form.html.erb | |
| <div class="field-unit__label"> | |
| <%= f.label field.permitted_attribute %> | |
| </div> | |
| <div class="field-unit__field"> | |
| <%= f.select(field.permitted_attribute) do %> | |
| <%= options_for_select(field.associated_resource_options(f.object.send("#{field.name}_candidates")), field.selected_option) %> | |
| <% end %> | |
| </div> |
| These two commands will minimise the diskspace used for the repo. Please note that Github, BitBucket run this all the time to minimise the diskspace. | |
| Suggestion: Run as often as you can (i.e. once a week for small working-in-progress repo, one in every few days if many people work together). | |
| It's no harm to run it often, cron or system task could be an option too. | |
| # Clean unused commits | |
| `git reflog expire --all --expire=now` | |
| # Compact the disk by remove unneccesary files from the local git repository | |
| `git gc --aggressive --prune=now` |
| # /config/initializers/sidekiq.rb | |
| current_web_concurrency = Proc.new do | |
| web_concurrency = ENV['WEB_CONCURRENCY'] | |
| web_concurrency ||= Puma.respond_to? | |
| (:cli_config) && Puma.cli_config.options.fetch(:max_threads) | |
| web_concurrency || 16 | |
| end | |
| local_redis_url = Proc.new do |
| r53 = AWS::Route53.new( | |
| :access_key_id => 'aws-key-id', | |
| :secret_access_key => 'aws-secret-key') | |
| response = r53.client.list_resource_record_sets( | |
| :hosted_zone_id => "zone-id", | |
| :start_record_name => 'xxx.example.com', | |
| :start_record_type => 'CNAME' | |
| ) | |
| puts response[:resource_record_sets].map{|r| r[:name]} |
| ### Nginx upstart script | |
| ### source: http://serverfault.com/a/391737/70451 | |
| ### /etc/init/nginx.conf | |
| description "nginx http daemon" | |
| start on (filesystem and net-device-up IFACE=lo) | |
| stop on runlevel [!2345] | |
| env DAEMON=/usr/local/sbin/nginx |