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 |
| <?php | |
| try { | |
| /* @var $installer Mage_Catalog_Model_Resource_Setup */ | |
| $installer = new Mage_Catalog_Model_Resource_Setup('core_setup'); | |
| $installer->startSetup(); | |
| $attribute = 'attribute_code'; | |
| $groupName = 'General'; // Or other | |
| $entityTypeId = $installer->getEntityTypeId('catalog_product'); |
| http://inchoo.net/magento/out-of-the-box-form-validation-in-magento/ |
| # Compila less | |
| sudo chmod -R 777 . && sudo php bin/magento cache:flush && sudo rm -rf var/* && sudo php bin/magento dev:source-theme:deploy --locale=pt_BR --theme=CleverSoft/ione | |
| # Limpa estatico | |
| sudo chmod -R 777 . && sudo php bin/magento cache:flush && sudo rm -rf var/* && sudo php bin/magento setup:static-content:deploy pt_BR && sudo php bin/magento dev:source-theme:deploy --locale=pt_BR |
| array('_secure' => $this->getRequest()->isSecure()) |
| // Expect input as d/m/y | |
| function isValidDate(s) { | |
| var bits = s.split('/'); | |
| var d = new Date(bits[2], bits[1] - 1, bits[0]); | |
| return d && (d.getMonth() + 1) == bits[1]; | |
| } | |
| ['0/10/2017','29/2/2016'].forEach(function(s) { | |
| console.log(s + ' : ' + isValidDate(s)) | |
| }) |
| <?php | |
| function validaCPF($cpf) { | |
| // Extrai somente os números | |
| $cpf = preg_replace( '/[^0-9]/is', '', $cpf ); | |
| // Verifica se foi informado todos os digitos corretamente | |
| if (strlen($cpf) != 11) { | |
| return false; |
| [ | |
| { | |
| "command": "escape" | |
| }, | |
| { | |
| "command": "expand_selection", | |
| "args": {"to": "word"} | |
| }, | |
| { | |
| "command": "copy" |
| # Purge all Varnish cache | |
| varnishadm "ban req.url ~ /" |
| <?php | |
| $attributeId = Mage::getResourceModel('eav/entity_attribute') | |
| ->getIdByCode('catalog_product', 'color'); |