Skip to content

Instantly share code, notes, and snippets.

View MaxSouza's full-sized avatar
🎯
Focusing

Max Souza MaxSouza

🎯
Focusing
  • 121Ecommerce
  • Gaspar, SC - Brazil
View GitHub Profile
@cagartner
cagartner / AddAttributeToGroupMagento.php
Last active February 24, 2020 20:48
Adiciona atributo a um grupo do magento 1 / add custom attribute to a custom attribute_set's group
<?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');
@igorhasse
igorhasse / gist:18c7e3fd5341c402841e2533a7422954
Created November 17, 2017 13:13
Validações Padrões Magento, formulários
http://inchoo.net/magento/out-of-the-box-form-validation-in-magento/
@igorhasse
igorhasse / magento-front-compile.bash
Last active January 16, 2018 16:15 — forked from cagartner/magento-front-compile.bash
comando para compilar thema lessa para css
# 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
@igorhasse
igorhasse / gist:2ee01ed1fd50ae52555051fae9dc06ae
Created September 22, 2017 14:08
Url segura dinamicamente no Magento
array('_secure' => $this->getRequest()->isSecure())
@igorhasse
igorhasse / valdation-date.js
Created August 28, 2017 21:13
Validation Valid Date
// 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))
})
@rafael-neri
rafael-neri / validar_cpf.php
Last active June 27, 2024 01:43
Validar CPF em PHP (Completo)
<?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"
@andrezrv
andrezrv / varnish-purge-cache.sh
Created November 2, 2013 06:07
Purge all Varnish cache.
# Purge all Varnish cache
varnishadm "ban req.url ~ /"
@jreinke
jreinke / gist:6508802
Created September 10, 2013 12:36
Magento: get attribute id by code
<?php
$attributeId = Mage::getResourceModel('eav/entity_attribute')
->getIdByCode('catalog_product', 'color');
@erikhenrique
erikhenrique / bin-cc.md
Last active June 30, 2024 22:14
Bin de cartões de crédito para validação

Validação para cartão de crédito.

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