Skip to content

Instantly share code, notes, and snippets.

View rafaelstz's full-sized avatar
👨‍🔬

Rafael Corrêa Gomes rafaelstz

👨‍🔬
View GitHub Profile
@rafaelstz
rafaelstz / post.md
Last active August 29, 2015 14:01 — forked from kbond/post.md
How to configure server

Install git:

sudo apt-get install git

Configure Git:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
git config --global user.name "Your Name"

git config --global user.email "Your Email"

@rafaelstz
rafaelstz / gist:38eb47672d05a6518bb8
Last active August 29, 2015 14:01 — forked from quafzi/gist:2234563
Magento Snippets

Magento Snippets

Find all dispatched event observers

grep -r Mage::dispatchEvent /path/to/your/Magento/* > events.txt

Find all translatable strings

@rafaelstz
rafaelstz / mysql-bkp-shell.sh
Last active August 29, 2015 14:01
Backup do Banco via ShellScript
#
# script by israelguido@gmail.com
#
echo "Digite seu dns";
read host;
echo "Digite seu user";
read user;
echo "Digite seu pass";
stty -echo
@rafaelstz
rafaelstz / find_txt_and_add_class.js
Last active August 29, 2015 14:07
Procura texto em uma classe e adiciona a classe.
if ( jQuery('.product-desc').length > 0 ) {
jQuery(function(){
jQuery('.product-desc').each(function(){
if ( jQuery(this).find(".prod-desc-tipo:contains('Grãos')").length > 0 ) {
jQuery(this).find('.icon').addClass('icon1');
}
else if ( jQuery(this).find(".prod-desc-tipo:contains('Cápsula')").length > 0 ) {
jQuery(this).find('.icon').addClass('icon2');
}
@rafaelstz
rafaelstz / price_product.js
Last active August 29, 2015 14:07
Colocado na Product View no Magento ele atualiza dinamicamente o valor do produto ao aumentar ou diminuir quantidade.
jQuery(window).load(function(){
/* Começa quando se clica em qualquer seta (cima e baixo) */
jQuery('.qty_control').click(function(){
// Quantidade no input
var quant = jQuery('.qty').val();
// Pega o preço (exemplo: 12.00)
var total = <?php echo $_product->getPrice(); ?>;
@rafaelstz
rafaelstz / .htaccess
Last active August 29, 2015 14:07
Otimização para compactar conteúdo gzip, definir cachê e etc.
<IfModule mod_deflate.c>
# Insert filter on all content
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
FileETag none
#php_flag zlib.output_compression On
# Make sure proxies don't deliver the wrong content
@rafaelstz
rafaelstz / get_url_Magento.txt
Created November 7, 2014 01:01
Pega a URL Base de um diretório matrix do Magento e exibe no phtml.
Get Url in phtml files
1. Get Base Url :
Mage::getBaseUrl();
2. Get Skin Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
@rafaelstz
rafaelstz / README.md
Last active August 29, 2015 14:09 — forked from aronwoost/README.md

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

@rafaelstz
rafaelstz / deploy
Created January 27, 2015 12:37
Auto Deploy
<?php
date_default_timezone_set('America/Sao_Paulo');
class Deploy {
public $post_deploy;
private $_log = 'var/log/deployments.log';
private $_date_format = 'Y-m-d H:i:sP';
private $_branch = 'develop';
@rafaelstz
rafaelstz / .htaccess
Created March 23, 2015 21:52
Magento Htaccess Optimization
####################################################################
################## Creare's Magento .htaccess File #################
####################################################################
##### Block unwanted Bots that clog the server #####
RewriteCond %{HTTP_USER_AGENT} MJ12bot
RewriteRule .* - [F]
RewriteCond %{HTTP_USER_AGENT} 80legs [NC]
RewriteRule ^ - [F]