Skip to content

Instantly share code, notes, and snippets.

View edheltzel's full-sized avatar
🇺🇸
Just your average run-of-the-mill kinda guy

Mr edheltzel

🇺🇸
Just your average run-of-the-mill kinda guy
View GitHub Profile
@edheltzel
edheltzel / php-server-with-wordpress.md
Last active November 26, 2020 21:33
Using PHP's built in server for WordPress development.

Preface

So in the past, I've used MAMP/MAMP Pro apps and others alike. I've also, setup my own local MAMP stack with homebrew, that used dnsmasq to dynamically add vhosts anytime I added a new folder to the Sites folder which made it very convenient. But, then I started running into other environment issues with PHP versions on remote machines/servers not being updated or some other crazy thingamabob breaking. I researched and invested time in Vagrant, but that seem to break more often than my homebrew setup. So I researched again investing time into Docker via Docker for Mac (which is BAMF), which I'm sold on and use daily, but it still seems a little bleeding edge and not so simple to wrap your head around the concept. Not to mention I don't have a real use case to play with and take advantage of all the features that come packed with Docker.

This is the beginning of trying to find something more simple, and slightly quicker to setup.

@edheltzel
edheltzel / config.yml
Last active June 2, 2021 21:41
This is my VERY opinionated install script for WordPress - you'll need to have wp-cli installed for this to work - I have this wrapped as an ZSH function inside of my dotfiles setup but you can easily convert to a bash script.
# -------------------------------------------------------------------
# This file live inside of your ~/.wp-cli
# -------------------------------------------------------------------
# path: cms # this is the path to your WordPress files
core install:
admin_user: <YOUR ADMIN USERNAME>
admin_password: <YOUR ADMIN PASSWORD>
admin_email: <YOUR ADMIN EMAIL>
title: The Next Big Deal in WordPress Sites
@edheltzel
edheltzel / Git push deployment in 7 easy steps.md
Created July 13, 2016 00:57 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@edheltzel
edheltzel / .htaccess
Last active May 31, 2016 20:11
redirect users based on Refereeing URL
RewriteEngine On
RewriteCond %{HTTP_REFERER} .*yelp.com.*$ [OR]
RewriteCond %{HTTP_REFERER} .*google.com.*$ [OR]
RewriteCond %{HTTP_REFERER} .*some_website.com.*$ [OR]
RewriteCond %{HTTP_REFERER} .*github.com.*$
RewriteRule ^(.*)$ http://your_site/custom_landing_page
@edheltzel
edheltzel / .htaccess
Last active May 25, 2016 11:41
route subdomain requests to directory
ErrorDocument 404 /
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.domain\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule (.*) http://domain.com/%1 [R=301,L,NC]
@edheltzel
edheltzel / git-selective-merge.md
Created February 23, 2016 16:44 — forked from katylava/git-selective-merge.md
git selective merge

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b temp
@edheltzel
edheltzel / uninstall_all_gems
Created February 17, 2016 19:19
Provided by [Romain on Stackoverflow](http://stackoverflow.com/a/8095250) Takes the list of all gems (incl. version stuff), cuts it to keep only the gem name, then uninstalls all versions of such gems. The `sudo` is only useful if you had gems installed system-wide, and should not be included unless necessary.
gem list | cut -d" " -f1 | sudo xargs gem uninstall -Iax
@edheltzel
edheltzel / functions.php
Created February 12, 2016 18:43
Create Duplicates - adds a duplication button to the dashboard for pages, posts and custom post types. Just add this to your functions.php file.
<?php
// Function creates post duplicate as a draft and redirects then to the edit post screen
function rdm_duplicate_post_as_draft(){
global $wpdb;
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'rdm_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
wp_die('No post to duplicate has been supplied!');
}
// get the original post id
@edheltzel
edheltzel / joyride.php
Created October 22, 2015 17:17
hacks for wordpress dashboard
<?php
/*-----------------------------------------------------------------------------------*/
/* UPDATE EMAIL ADDRESS FOR WORDPRESS
/* ----------------------------------------------------------------------------------*/
// AUTO-DETECT THE SERVER
function rdm_filter_wp_mail_from($email){
// START OF CODE LIFTED FROM WORDPRESS CORE
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
$sitename = substr( $sitename, 4 );
@edheltzel
edheltzel / .htaccess
Last active November 25, 2015 17:38
Basic .htaccess file for postname permalinksApache rewrite module must be enabled -- mainly used for YeoPress
# Basic .htaccess file for postname permalinks
# Apache rewrite module must be enabled
# Rewrites / Permalinks
# =====================
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /