Skip to content

Instantly share code, notes, and snippets.

View rickbenetti's full-sized avatar

Rick Benetti rickbenetti

View GitHub Profile
@rickbenetti
rickbenetti / head.phtml
Last active September 7, 2023 07:41
Add header rich snippets to your Magento Store
<?php
/**
*
* Copyright (c) 2013 Studio Boz
*
* @project_name Studio Boz
* @copyright Copyright (c) 2013 Studio Boz (http://studioboz.com.br)
* @author Rick Benetti <rick@studioboz.com.br>
*
**/
@rickbenetti
rickbenetti / README.md
Created October 20, 2018 00:12 — forked from remcotolsma/README.md
WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more

WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more

Brew

http://brew.sh/

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
@rickbenetti
rickbenetti / debug_remove_menu_admin.php
Created July 27, 2016 16:53
Functions examples to remove menu and submenu pages in admin wordpress.
if (!function_exists('debug_admin_menus')):
function debug_admin_menus() {
if ( !is_admin())
return;
global $submenu, $menu, $pagenow;
if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN
if( $pagenow == 'index.php' ) { // PRINTS ON DASHBOARD
echo '<pre>'; print_r( $menu ); echo '</pre>'; // TOP LEVEL MENUS
echo '<pre>'; print_r( $submenu ); echo '</pre>'; // SUBMENUS
}
@rickbenetti
rickbenetti / nginx.conf
Created September 6, 2018 17:33 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
@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 / upgrade-php.sh
Created June 7, 2017 04:02
Scotch Box - Vagrant - Install php7
## Update package list
sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
### Install PHP7 and remove PHP5
sudo apt-get update
sudo apt-get purge php5-common -y
sudo apt-get install -y \
&& php7.0 \
&& php7.0-fpm \
@rickbenetti
rickbenetti / functions.php
Created December 14, 2016 02:00 — forked from joecue/functions.php
Reset WordPress User Role Capabilities
if ( !function_exists( 'populate_roles' ) ) {
require_once( ABSPATH . 'wp-admin/includes/schema.php' );
}
populate_roles();
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: 'Source Code Pro',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@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--