Skip to content

Instantly share code, notes, and snippets.

@nathanieltubb
nathanieltubb / rare.sh
Created July 13, 2017 17:29 — forked from yosukehasumi/rare.sh
Create a new wordpress boilerplate theme
#!/usr/bin/env bash
VERSION=2.0.13;
# Download this file, rename it to "rare", and place it in your bin directory (for mac it'll be something like usr/local/bin/rare).
# For OSX you could try this CURL command to install it:
# curl https://gist.githubusercontent.com/yosukehasumi/d0c905da78229122e7c1bb34a0fc92a7/raw/rare.sh > /usr/local/bin/rare;
# sudo chmod 755 /usr/local/bin/rare;
#
# To use this script, cd into your project directory and in command line type:
@nathanieltubb
nathanieltubb / addlocalhost
Last active May 30, 2017 01:53
Bash Script to Add a Custom Localhost to Brew Apache Mac OSX
#!/bin/bash
# USAGE: addlocalhost mycustomsite.localhost /path/to/document/root/
HNAME=$1
HPATH=$2
HOSTSFILE="/etc/hosts"
HTTPSITESFILE="/usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf"
if ! [[ -n $HNAME || -n $HPATH ]]; then
@nathanieltubb
nathanieltubb / recursive-file-fold-permissions.md
Last active June 22, 2020 18:14
Recursively Change Permissions for File-only or Folders-only

Files-only in Current Directory Down

sudo find . -type f -exec chmod 644 {} \;

Folders-only in Current Directory Down

sudo find . -type d -exec chmod 755 {} \;

Example of Resetting Git-Auto-Deploy .GIT Directory

sudo chown -R git-auto-deploy:git-auto-deploy .git;
sudo find .git -type f -exec chmod 664 {} \;
sudo find .git -type d -exec chmod 775 {} \;
@nathanieltubb
nathanieltubb / wp-health.php
Last active February 28, 2017 23:03
Medium Rare WP Website Health Check
<?php
$items = array(
array(
'label' => 'Core',
'name' => 'core',
'items' => array(
'Wordpress is up to date',
)
),
array(
@nathanieltubb
nathanieltubb / ubuntu-server-add-user.md
Last active November 7, 2016 22:27
Adding New SFTP User on a Digitial Ocean Ubuntu Server

Adding A New SFTP User

As root or via sudo add the user with a home directory, where "developer" is the new username:

useradd -d /home/developer -m developer

Update the new user's password; making sure you use a very strong one:

passwd developer

@nathanieltubb
nathanieltubb / admin-functions.php
Last active October 17, 2016 22:30
WordPress TinyMCE Editor Adding Custom Buttons + Enabling Hidden Buttons
<?php
//---------------------------------------------------------------
/**
* Registers an editor stylesheet for the theme.
*/
function custom_theme_add_editor_styles() {
add_editor_style( 'editor-style.css' );
}
add_action( 'admin_init', 'custom_theme_add_editor_styles' );
//---------------------------------------------------------------
@nathanieltubb
nathanieltubb / wp-db-reset-users-metabox-locations.sql
Last active July 13, 2018 21:57
WordPress Database Reset All Users' Metabox Locations
-- Reset all users' metabox placement. This is useful when changing location of existing ACF field groups.
-- Run these separately, and replace the table prefix and meta_keys with your own.
-- Search for current metabox values:
SELECT *
FROM wp_usermeta
WHERE meta_key
LIKE 'meta%'
-- Look for the meta-box-order_[post_type_slug] and metaboxhidden_[post_type_slug] keys.
-- Run the reset on the necessary rows based on the post type you are targeting.