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 |
<form action="<%= form_url %>" method="post" enctype="multipart/form-data" data-attachment-form='entity' id='upload_company_logo_form'> | |
<div style='display: none'> | |
<input type="hidden" name="key" value="<%= s3_object_key %>" /><br/><br/> | |
<input type="hidden" name="acl" value="public-read" /><br/> | |
<input type="hidden" name="success_action_redirect" value="<%= success_action_redirect %>" /><br/> | |
<input type="hidden" name="AWSAccessKeyId" value="<%= ENV['AWS_ACCESS_KEY_ID'] %>" /> | |
<input type="hidden" name="policy" value=<%= policy %> /> | |
<input type="hidden" name="signature" value=<%= signature %> /> | |
</div> | |
<div class='add-attachment'> |
require 'fiber' | |
class Factory | |
class Callbacks | |
def initialize(handler, actions) | |
@handler, @actions = handler, actions | |
end |
CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french ); | |
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING | |
FOR hword, hword_part, word WITH unaccent, french_stem; | |
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english ); | |
ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING | |
FOR hword, hword_part, word WITH unaccent, english_stem; | |
CREATE TEXT SEARCH CONFIGURATION de ( COPY = german ); | |
ALTER TEXT SEARCH CONFIGURATION de ALTER MAPPING |
class CreateTransactionsInvoicesTriggers < ActiveRecord::Migration | |
def up | |
add_column :credit_card_invoices, :balance_cents, :integer, null: false, default: 0 rescue nil | |
execute <<-SQL | |
DROP TRIGGER IF EXISTS update_invoice_after_create_transaction; | |
SQL |
CREATE OR REPLACE FUNCTION hash_password_on_insert() RETURNS trigger AS | |
$FUNCTION$ | |
BEGIN | |
IF NEW.encrypted_password IS NULL THEN | |
RAISE EXCEPTION 'password cannot be null'; | |
END IF; | |
IF char_length(NEW.encrypted_password) < 8 THEN | |
RAISE EXCEPTION 'password is to short, should be greater than 8 chars'; |
CREATE OR REPLACE FUNCTION hash_password_on_insert() RETURNS trigger AS | |
$FUNCTION$ | |
BEGIN | |
IF NEW.encrypted_password IS NULL THEN | |
RAISE EXCEPTION 'password cannot be null'; | |
END IF; | |
IF char_length(NEW.encrypted_password) < 8 THEN | |
RAISE EXCEPTION 'password is to short, should be greater than 8 chars'; |
CREATE OR REPLACE FUNCTION hash_password() RETURNS trigger AS | |
$$ | |
if(TG_OP == 'INSERT' || OLD.encrypted_password != NEW.encrypted_password) { | |
if(NEW.encrypted_password == null) throw new Error('password cannot be null'); | |
if(NEW.encrypted_password.length < 8 || NEW.encrypted_password.length > 72) { | |
throw new Error('password length must be beteween 8 and 72'); | |
} |
module Cache | |
def write_fragment(key, content, options = nil) | |
return content unless cache_configured? | |
key = fragment_key(key) | |
content = content.to_str | |
fragments_to_write << key | |
fragments_to_write << ActiveSupport::Gzip.compress(content) | |
content | |
end | |
#!/bin/bash | |
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
############################################### | |
# To use: | |
# wget https://gist.githubusercontent.com/esdras/5d1f13fa37073ce23f3f/raw/install-redis.sh | |
# chmod 777 install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
echo "*****************************************" |