Skip to content

Instantly share code, notes, and snippets.

Avatar

Rick Benetti rickbenetti

View GitHub Profile
@rickbenetti
rickbenetti / README.md
Created Oct 20, 2018 — forked from remcotolsma/README.md
WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more
View README.md

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 / nginx.conf
Created Sep 6, 2018 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
View nginx.conf
# 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 / upgrade-php.sh
Created Jun 7, 2017
Scotch Box - Vagrant - Install php7
View upgrade-php.sh
## 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 Dec 14, 2016 — forked from joecue/functions.php
Reset WordPress User Role Capabilities
View functions.php
if ( !function_exists( 'populate_roles' ) ) {
require_once( ABSPATH . 'wp-admin/includes/schema.php' );
}
populate_roles();
View .hyper.js
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 / debug_remove_menu_admin.php
Created Jul 27, 2016
Functions examples to remove menu and submenu pages in admin wordpress.
View debug_remove_menu_admin.php
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
}
View 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 Mar 16, 2016 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup
View osx-10.10-setup.md

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

View hide_update_notice.php
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 );
You can’t perform that action at this time.