Skip to content

Instantly share code, notes, and snippets.

View rickbenetti's full-sized avatar

Rick Benetti rickbenetti

View GitHub Profile
@rickbenetti
rickbenetti / WORDPRESS: change Posts label in admin area
Last active April 5, 2016 12:42 — forked from raaar/WORDPRESS: change Posts label in admin area
WORDPRESS: change Posts label in admin area
function change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = 'Blog';
$submenu['edit.php'][5][0] = 'Blog';
$submenu['edit.php'][10][0] = 'Adicionar publicação';
$submenu['edit.php'][16][0] = 'Blog Tags';
echo '';
@rickbenetti
rickbenetti / osx-10.10-setup.md
Last active March 16, 2016 13:16 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

function hide_update_notice_to_all_but_admin_users()
{
if (!current_user_can('update_core')) {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 );
# Write a /etc/sudoers on OS X for vagrant 1.7.3 and above with these entries:
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
@rickbenetti
rickbenetti / php_reindexer.php
Created November 1, 2013 16:52
Indexação de base do Magento via php
Is there a way to stop a magento indexer process?
php -f indexer.php reindex all
Stock Status Index process is working now. Please try run this process later.
Product Prices Index process is working now. Please try run this process later.
Catalog URL Rewrites Index process is working now. Please try run this process later.
Product Flat Data Index process is working now. Please try run this process later.
Category Flat Data Index process is working now. Please try run this process later.
Category Products Index process is working now. Please try run this process later.
Catalog Search Index Index process is working now. Please try run this process later.
Stock Status index was rebuilt successfully
@rickbenetti
rickbenetti / navigation.php
Created October 2, 2013 18:38
Para remover links do menu dentro da área de usuário no magento basta adicionar o unset no arquivo em: app/design/frontend/[NomePacote]/default/template/customer/account/navigation.phtml
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@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; ?>