Skip to content

Instantly share code, notes, and snippets.

View gabidavila's full-sized avatar
💁‍♀️
I try to solve all my problems with a single SQL query.

Gabriela Ferrara gabidavila

💁‍♀️
I try to solve all my problems with a single SQL query.
View GitHub Profile
@gabidavila
gabidavila / product_attributes
Last active December 16, 2015 04:19
Alterar valor de atributo para todos os produtos no Magento Change attribute value for all products in Magento
<?php
//get all products
$products = Mage::getResourceModel('catalog/product_collection')->getAllIds();
//Now create an array of attribute_code => values
$attributesData = array(
array('orig' => 1),
array('ncm' => 33030020),
array('ucom' => 'un'),
array('subst' => 1)
@gabidavila
gabidavila / Git_Colors
Created April 13, 2013 00:44
GIT Colorido Colored GIT
git config --global color.ui auto
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto
@gabidavila
gabidavila / magento_increment_id.sql
Created April 13, 2013 00:47
Alterar numeração de um pedido no Magento / Change Increment ID Magento
UPDATE eav_entity_store
SET increment_last_id = '100180000'
WHERE
entity_store_id = 1
@gabidavila
gabidavila / sorce_model.php
Created April 13, 2013 00:54
Source model customized Magento
<?php
class Namespace_Module_Model_Customfield extends Mage_Core_Model_Abstract {
protected function _construct() {
$this->_init('namespace/customfield');
}
public function toOptionArray() {
$options = array(
0 => array('value' => 'SP', 'label' => 'São Paulo'),
1 => array('value' => 'MG', 'label' => 'Minas Gerais'),
@gabidavila
gabidavila / estados_brasileiros.sql
Last active August 3, 2016 20:34
Estados Brasileiros do Magento
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES
('BR', 'AC', 'Acre');
INSERT INTO `directory_country_region_name` (`locale`, `region_id`, `name`) VALUES
('en_US', LAST_INSERT_ID(), 'Acre'), ('pt_BR', LAST_INSERT_ID(), 'Acre');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES
('BR', 'AL', 'Alagoas');
INSERT INTO `directory_country_region_name` (`locale`, `region_id`, `name`) VALUES
('en_US', LAST_INSERT_ID(), 'Alagoas'), ('pt_BR', LAST_INSERT_ID(), 'Alagoas');
@gabidavila
gabidavila / pacote.sh
Created April 15, 2013 18:44
Gerar pacote tar.gz git
git diff --name-only 859f95bc 94a94459 | tar -czvpf patch_20130207.tar.gz -T -
@gabidavila
gabidavila / Aws.sh
Created May 28, 2013 02:41
Parametros de incializacao de instancia no AWS
#!/bin/sh
yum -y install httpd php
/sbin/chkconfig httpd on
/etc/init.d/httpd start
@gabidavila
gabidavila / tamanho_db.sql
Created September 17, 2013 02:12
Tamanho dos bancos de dados de um determinado host
SELECT
table_schema "Nome DB",
SUM( data_length + index_length) / 1024 / 1024 "Tamanho em MB"
FROM
information_schema.TABLES
GROUP BY
table_schema;
@gabidavila
gabidavila / git_file_permission.sh
Created November 3, 2013 21:13
Ignorar alteração de permissões de arquivos no GIT Ignore file permissions change on GIT
git config core.fileMode false
@gabidavila
gabidavila / git_colors.sh
Created November 3, 2013 21:35
GIT Colorido na linha de comando | Add Colors to GIT command Line
git config --global color.ui auto
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto