Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@pwenzel
pwenzel / 0. mamp_install_composer.bash
Last active March 30, 2021 16:47
Global composer install for MAMP Users on OSX
# Global composer install for MAMP Users on OSX
# http://getcomposer.org/doc/00-intro.md#globally
# For PHP 5.4 Use:
# alias php=/Applications/MAMP/bin/php/php5.4.4/bin/php;
alias php=/Applications/MAMP/bin/php/php5.3.6/bin/php;
curl -sS https://getcomposer.org/installer | php;
mv composer.phar /usr/local/bin/composer;
composer help;
@pwenzel
pwenzel / Makefile
Last active October 12, 2021 13:29
Wordpress Makefile Workflow
.PHONY: install
install: clean wordpress phpunit wp-cli
git submodule init;
@echo "\n\nNOTICE: You may need to configure a MySQL database for your Wordpress installation. Just run:"
@echo " mysql -u root -p;"
@echo " CREATE DATABASE example_site; \n"
wordpress: latest.tar.gz
tar -zxvf latest.tar.gz;
@pwenzel
pwenzel / Test page download with time and curl.sh
Last active December 24, 2015 07:59
Ways to check download times
time curl http://www.wikipedia.org > /dev/null
@pwenzel
pwenzel / 01-Makefile
Last active February 20, 2020 13:56
This gist accompanies https://github.com/pwenzel/fswatch-makefile. It shows how one might build a tiny build system for a website using a Makefile.
# Example Makefile for compiling CSS and Javascript in watched folder
PHONY: optimize
css:
@cat assets/css/normalize.css assets/css/app.css > public/assets/all.css
@echo Built all.css
js:
@cat assets/js/jquery.js assets/js/jquery.cookie.js assets/js/app.js > public/assets/all.js
@pwenzel
pwenzel / Makefile
Created February 6, 2014 17:12
This gist accompanies https://github.com/pwenzel/fswatch-makefile. It shows how one might build a tiny build system for a website using a Makefile.
# Example Makefile for compiling CSS and Javascript in watched folder
PHONY: optimize
css:
@cat assets/css/normalize.css assets/css/app.css > public/assets/all.css
@echo Built all.css
js:
@cat assets/js/jquery.js assets/js/jquery.cookie.js assets/js/app.js > public/assets/all.js
@pwenzel
pwenzel / config.yaml
Created May 5, 2014 15:25
~/.config/beets/config.yaml
directory: /Volumes/BigMedia/Beets
library: /Volumes/BigMedia/Beets.blb
import:
move: no
copy: yes
write: yes
paths:
default: $albumartist - $album%aunique{}/$track $title
singleton: $albumartist - Singles/$artist - $title
comp: $album%aunique{}/$track $artist - $title
@pwenzel
pwenzel / meta.php
Created May 22, 2014 21:02
Wordpress meta tags without a plugin
<?php
/**
* @link Escape post content in META Attributes, http://codex.wordpress.org/Data_Validation
* @link Complete List of HTML Meta Tags, https://gist.github.com/kevinSuttle/1997924
* @example get_template_part('meta');
*/
?>
<meta name="twitter:card" content="summary">
<!--<meta name="twitter:site" content="@YOUR_TWITTER_HANDLE">-->
@pwenzel
pwenzel / lamp-stack-osx-virtualhostx.md
Last active April 8, 2022 04:00
LAMP stack on OSX with Homebrew, built-in Apache, multiple PHP versions, VirtualhostX optional

This guide shows how to set up a PHP and MySQL development environment using OSX's built-in Apache, using Homebrew to install necessary components. With this strategy, you can use different versions of PHP for certain virtual hosts.

VirtualHostX is a convenient way to manage development sites, but not required.

Install PHP and MySQL with Homebrew

brew update
brew install php56
brew install php56-mcrypt
brew install mysql
@pwenzel
pwenzel / attr_fix_cptr.php.diff
Created December 8, 2014 02:29
Fix Unescaped Title Attributes in plugin Custom Post Types Relationships (CPTR)
diff --git a/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php b/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
index 2d82e17..853a51d 100644
--- a/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
+++ b/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
@@ -136,7 +136,7 @@ function cptr_category_selector() {
if (!empty($relations)) :
foreach($relations as $relation) :
$post = get_post($relation);
- echo "<div title='" . $post->post_title . "' class='thepost' id='post-".$post->ID ."'>
+ echo "<div title='" . esc_attr($post->post_title) . "' class='thepost' id='post-".$post->ID ."'>