Skip to content

Instantly share code, notes, and snippets.

View michelbrito's full-sized avatar

Michel Brito michelbrito

View GitHub Profile
@michelbrito
michelbrito / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@michelbrito
michelbrito / gist:409f7c02196ecd1ed4ea
Created July 22, 2014 19:30
Magento count() vs getSize()
<?php
/*
O COUNT() primeiro carrega toda a collection e depois conta quantos itens tem. Por isso dependendo da situação, não é melhor opção a se usar para saber se tem registros.
Arquivo: lib/Varien/Data/Collection.php
public function count()
{
$this->load();
return count($this->_items);
}
@michelbrito
michelbrito / retina2nonretina.sh
Created December 19, 2012 10:02
Automatically generate all non-retina images
#!/bin/bash
# Downsamples all retina ...@2x.png images.
echo "Downsampling retina images..."
dir=$(pwd)
find "$dir" -name "*@2x.png" | while read image; do
outfile=$(dirname "$image")/$(basename "$image" @2x.png).png
@michelbrito
michelbrito / gist:1083205
Created July 14, 2011 19:18
Lista de estados em HTML
<select name="estado">
<option selected="" value="">Selecione o Estado (UF)</option>
<option value="Acre">Acre</option>
<option value="Alagoas">Alagoas</option>
<option value="Amapá">Amapá</option>
<option value="Amazonas">Amazonas</option>
<option value="Bahia">Bahia</option>
<option value="Ceará">Ceará</option>
<option value="Distrito Federal">Distrito Federal</option>
<option value="Espírito Santo">Espírito Santo</option>
@michelbrito
michelbrito / delete_all_customers.sql
Last active December 2, 2016 19:42
Magento - Delete all customers
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `customer_address_entity`;
TRUNCATE TABLE `customer_address_entity_datetime`;
TRUNCATE TABLE `customer_address_entity_decimal`;
TRUNCATE TABLE `customer_address_entity_int`;
TRUNCATE TABLE `customer_address_entity_text`;
TRUNCATE TABLE `customer_address_entity_varchar`;
TRUNCATE TABLE `customer_entity`;
TRUNCATE TABLE `customer_entity_datetime`;
@michelbrito
michelbrito / delete_all_categories.sql
Last active September 24, 2015 22:57
Magento - Delete all categories
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_category_entity`;
TRUNCATE TABLE `catalog_category_entity_datetime`;
TRUNCATE TABLE `catalog_category_entity_decimal`;
TRUNCATE TABLE `catalog_category_entity_int`;
TRUNCATE TABLE `catalog_category_entity_text`;
TRUNCATE TABLE `catalog_category_entity_varchar`;
TRUNCATE TABLE `catalog_category_product`;
TRUNCATE TABLE `catalog_category_product_index`;
@michelbrito
michelbrito / delete_all_products.sql
Last active January 13, 2016 21:23
Magento - Delete all products
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
@michelbrito
michelbrito / cidades
Created January 24, 2011 07:13
Cidades Relacionadas com os Estados Brasileiros
1|Acrelândia
1|Assis Brasil
1|Brasiléia
1|Bujari
1|Capixaba
1|Cruzeiro do Sul
1|Epitaciolândia
1|Feijó
1|Jordão
1|Mâncio Lima
@michelbrito
michelbrito / estados
Created January 24, 2011 06:43
Lista de Estados Brasileiros
AC|Acre
AL|Alagoas
AP|Amapá
AM|Amazonas
BA|Bahia
CE|Ceará
DF|Distrito Federal
ES|Espírito Santo
GO|Goiás
MA|Maranhão
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09 for most of these projects, and the "last update" field has not been kept up to date since then.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09