Skip to content

Instantly share code, notes, and snippets.

View rickbenetti's full-sized avatar

Rick Benetti rickbenetti

View GitHub Profile
@rickbenetti
rickbenetti / qty-magento.php
Created September 27, 2013 23:10
Bloco para adicionar funcionalidade de incremento e decremento no box de quantidade na tela de produto.
<div class="qty-box">
<label for="qty"><sup>*</sup> <?php echo $this->__('Qty') ?></label>
<div class="qty-wrapper">
<input type="text" name="qty" id="qty" maxlength="3" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<div class="actions">
<a class="btn-increment" href="javascript:void(0);" title="<?php echo $this->__('Increment Value')?>"><?php echo $this->__('Increment Value')?></a>
<a class="btn-decrement" href="javascript:void(0);" title="<?php echo $this->__('Decrement Value')?>"><?php echo $this->__('Decrement Value')?></a>
</div>
</div>
</div>
@rickbenetti
rickbenetti / wpconfig-define-options
Created July 22, 2013 00:36
wp-config.php all define options
<?php
if( stristr( $_SERVER['SERVER_NAME'], "dev" ) ) {
// Dev Environment
define( 'DB_NAME', 'project_dev' );
define( 'DB_USER', 'project_dev_user' );
define( 'DB_PASSWORD', 'password' );
define( 'DB_HOST', 'localhost' );
define( 'WP_HOME', 'http://project.dev');
define( 'WP_SITEURL', WP_HOME);
// Dev will always want debug on and caching off
@rickbenetti
rickbenetti / .gitcontg
Created June 5, 2013 20:39
Configuração básica do .gitconfig
[user]
email = youremail@domain.com
name = Your Name or Nickname
[push]
default = matching
[alias]
ps = push
pl = pull
pom = pull origin master
poh = pull origin homologa
@rickbenetti
rickbenetti / columns-head.phtml
Last active December 18, 2015 00:59
## Magento1column.php, 2columns-left.php, 2columns-right.php and 3columns.php use this head tagging.Price produto page taggingHead content to add rich snippets to all pages by home or product page.
<?php if ( Mage::registry('current_product') ) : ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Product">
<?php elseif( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ): ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Store">
<?php endif; ?>
for file in `find . -name "*.xml"`; do xmllint --noout $file; done
fará uma busca por todos os arquivos xml recursivamente e mostrará se houver algum com erro de sintaxe, tags nao fechadas, etc

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@rickbenetti
rickbenetti / Adicionar suporte à SVG e Web Fonts
Created May 16, 2013 10:39
Conjunto de regras para adicionar suporte à SVG e Web Fonts através de um arquivo .htaccess na raiz de cada projeto.
############################################
## Fonts Support - for Apache Server ##
############################################
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
# webfont mime types

Contrato Arrasador 3

Atualizado em: 11/07/2012

Entre nós [nome da empresa] e você [nome do cliente]

Sumário:

Nós faremos o melhor para satisfazer suas necessidades e atender suas expectativas, mas é importante registrar tudo por escrito para que todos conheçam suas responsabilidades (quem faz o quê) e saibam o que acontece quando algo dá errado. Neste contrato você não encontrará termos jurídicos complicados ou textos longos e incompreensíveis. Nós não temos interesse em fazê-lo assinar algo que poderá se arrepender depois. O que nós queremos é o melhor para os dois lados, agora e no futuro.

// img unautop, Courtesy of Interconnectit http://interconnectit.com/2175/how-to-remove-p-tags-from-images-in-wordpress/
// add img class and alignment to figure by @_RickBenetti
function img_unautop($pee) {
$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '<figure class="'. $class+$align .'">$1</figure>', $pee);
return $pee;
}
add_filter( 'the_content', 'img_unautop', 30 );