Skip to content

Instantly share code, notes, and snippets.

View rickbenetti's full-sized avatar

Rick Benetti rickbenetti

View GitHub Profile
@rickbenetti
rickbenetti / delay-submenu.js
Created June 15, 2014 13:25
Delay to show submenu
$('#main-menu .main-menu .nav-item').hover(function() {
if ($(this).find('.submenu-container').length > 0) {
$(this).addClass("nav-selected");
$(this).find('.submenu-container').show();
}
}, function() {
var object = $(this);
setTimeout(function()
{
$(object).find('.submenu-container').hide();
@rickbenetti
rickbenetti / localhost - permissions
Created August 19, 2014 15:51
From http://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress Just correct folder and files permissions for magento and wordpress to.
chown -R _www:_www * # Let apache be owner
sudo find . -type d -exec chmod 755 {} \; # rwxr-xr-x
sudo find . -type f -exec chmod 644 {} \; # rw-r--r--
<?php // Check to see if the item is in stock
if($_product->stock_item->is_in_stock == 1):
echo $this->__('Availability') ?>: <strong><?php echo $this->__('In stock') ?></strong> ?>
<?php else: ?>
<strong><a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>contacts/" title="<?php echo $this->__('Email') ?>"><?php echo $this->__('Email') ?></a></strong> <?php echo $this->__('or Call for Availability') ?>&nbsp;1-222-333-444
<?php endif; ?>
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<?php //Irá exibir o valor do atributo no label como: Cor, Tamanho, Dimensões e etc... ?>
<div class="options">
<label for="super_attribute[<?php echo $_attribute->getAttributeId() ?>]"><?php echo $_attribute->getProductAttribute()->getAttributeCode(); ?></label>
<div class="dropdown-select">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
@rickbenetti
rickbenetti / default-web-fonts.txt
Created September 9, 2014 16:06
Padrões de fontes para uso em sites e e-mail marketins.
font-family: Arial, Helvetica, sans-serif;
font-family: ‘Arial Black’, Gadget, sans-serif;
font-family: ‘Bookman Old Style’, serif;
font-family: ‘Comic Sans MS’, cursive;
font-family: Courier, monospace;
font-family: ‘Courier New’, Courier, monospace;
font-family: Garamond, serif;
font-family: Georgia, serif;
font-family: Impact, Charcoal, sans-serif;
font-family: ‘Lucida Console’, Monaco, monospace;
<?php echo $this->getLayout()->createBlock('enterprise_banner/widget_banner')->setBannerIds('4')->setDisplayMode('fixed')->setTemplate('banner/widget/block.phtml')->toHtml(); ?>
@rickbenetti
rickbenetti / lamp-config
Created December 9, 2014 17:44
LAMP préconfiguração
$ sudo apt-get install git apache2 php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl mysql-server mysql-client phpmyadmin snmp-mibs-downloader php-pear -y;
$ sudo pear install PHP_CodeSniffer;
------(not recomend)--------
$ sudo pear channel-discover pear.pdepend.org;
$ sudo pear install pdepend/PHP_Depend-1.1.4;
$ sudo pear channel-discover pear.phpmd.org;
$ sudo pear install phpmd/PHP_PMD-1.5.0;
--------------------------------------------------
@rickbenetti
rickbenetti / install-rbenv-ruby
Created December 9, 2014 19:01
Install Ruby on ubuntu
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
# I like tunning the colors of the prompt in the first place:
export CLICOLOR='true'
export LSCOLORS="gxfxcxdxbxCgCdabagacad"
export EDITOR=vi
# Git branch in good-looking prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Encrypt the repository
# Remove/modify this line if the repository is meant to be open-source
*.* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.phtml text
*.css text
*.js text