Skip to content

Instantly share code, notes, and snippets.

Phil Banks emirpprime

Block or report user

Report or block emirpprime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
#!/bin/bash -e
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
read -e setupmysql
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
read -e mysqluser
emirpprime /
Created Nov 28, 2019
Git merge conflict test generator
# No conflict, changes in branch time order.
mkdir merge-conflict1
cd merge-conflict1
git init
git add
echo $'Start\nOne\n\n\n\nTwo\n\n\n\nThree\n\n\n\nFour\n\n\n\nEnd' >
git commit -am 'initial commit on master'
emirpprime / products_with_category.sql
Last active Nov 20, 2019
Select Product name, SKU, price and category from WordPress / WooCommerce with MySQL query
View products_with_category.sql
wp_posts.post_title AS Product,
wp_postmeta1.meta_value AS SKU,
wp_postmeta2.meta_value AS Price,
FROM wp_posts
LEFT JOIN wp_postmeta wp_postmeta1
ON wp_postmeta1.post_id = wp_posts.ID
AND wp_postmeta1.meta_key = '_sku'
LEFT JOIN wp_postmeta wp_postmeta2
emirpprime / social.php
Created Aug 2, 2019
Basic social OG tag generation for WordPress
View social.php
* Plugin Name: Social Test
* TODO: Output <meta name="twitter:site" content="@username" />? Needs custom option to read from.
* TODO: Custom option for social fallback image instead of core image?
* Adding the Open Graph schema definitions in the Language Attributes.
emirpprime / Pure CSS Offsets
Last active Jul 23, 2019
CSS to add offsets to Pure grids
View Pure CSS Offsets
Offsets from
Media queries from Pure v0.5.0
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
@media screen and (min-width: 35.5em) {
.offset-sm-0 {
emirpprime / gform_clamav.php
Created Aug 8, 2016
Scan Gravity Forms uploads with ClamAV - WordPress
View gform_clamav.php
* Scan Gravity Forms uploads with ClamAV
* Based on 'Custom Scan AV function by Kris Chase'
* Requires clamav and php-clamav installed and enabled
function myfunc_uploads_clamav( $validation_result ) {
if ( $_FILES ) {
$form = $validation_result['form'];
emirpprime /
Last active Dec 12, 2018
Sledgehammer removal of valet(+)
#!/usr/bin/env bash
valet stop
composer global remove laravel/valet
composer global remove weprovide/valet-plus
brew services stop --all
brew uninstall dnsmasq
sudo rm -rf /usr/local/etc/dnsmasq.conf
sudo rm -rf /usr/local/Cellar/dnsmasq
emirpprime / time_ago.php
Last active Nov 30, 2018
Filter WordPress date functions to return relative time strings.
View time_ago.php
* Filter the_time and get_the_date to return a relative string.
* Inspired by
* Based on code from
* @param string $formatted The formatted time.
* @param string $format The time format used.
* @param object $the_post Optional - current Post object.
* @return string Modified formatted time.
#!/bin/bash -e
# Description:
# This will deploy WordPress in the current directory.
# Without modification it:
# - will configure basic security:
# - remove initial user created
# - deploy 6G firewall in .htaccess
# - attempt to prevent user enumeration in .htaccess
# - protect sensitive files and disallow executables in /wp-uploads
emirpprime /
Last active Aug 5, 2018
Utility script to help manage WordPress sites on an EasyEngine server (but not limited to EE)
# Help / usage info.
USAGE=$'WordPress Helper script, built for EasyEngine but should be widely compatible.\nWithout any args it will search /var/www/ for WordPress sites, loop over them in alphabetical order and check for core and plugin updates.\nAlso accepts:\n\t--sites=[space seperated list of site paths relative to /var/www]\n\t--update=[plugins|wp|all].'
# Die function for exiting on errors.
die () {
echo "${1}, exitting..." >&2 ; echo ; exit 1
You can’t perform that action at this time.