Skip to content

Instantly share code, notes, and snippets.

Jonathan Bardo jonathanbardo

Block or report user

Report or block jonathanbardo

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
jonathanbardo / __return.php
Last active Dec 11, 2016
If WordPress required PHP >= 5.3
View __return.php
if ( ! function_exists( '__return' ) ) {
function __return( $return ) {
return function() use ( $return ) {
return $return;
jonathanbardo / dnsmasq
Last active Jul 13, 2016
dnsmasq setup on mac os x 10.11
View dnsmasq
# using .domain to
echo 'address=/.domain/' >> /usr/local/etc/dnsmasq.conf
# make sure the file name in /etc/resolver is the same as your domain
sudo bash -c 'echo "nameserver" > /etc/resolver/domain'
# restart dnsmasq
sudo brew services restart dnsmasq
jonathanbardo / reverse-wpautop.php
Last active Dec 29, 2018
Opposite of wpautop
View reverse-wpautop.php
* Do the opposite of wpautop
* @param string $s
* @return string
public static function reverse_wpautop( $s ) {
jonathanbardo /
Created Mar 15, 2016 — forked from textarcana/
Headless Selenium on CentOS 6.3 (Mac XWindows / X11 / Xvfb / Headless Firefox / Selenium howto)

XWindows for Headless Selenium

X Wing art by Paul Harckham

How to set up a Headless Selenium Testing environment for CentOS 6.3.

On your CentOS 6.3 host

Follow these steps to set up a CentOS 6.3 host to run headless Selenium tests with Firefox.

jonathanbardo / email.php
Last active Aug 29, 2015
Send email using WordPress
View email.php
function smtp_mail( $phpmailer ) {
// Define that we are sending with SMTP
// The hostname of the mail server
$phpmailer->Host = YOURHOST;
// Use SMTP authentication (true|false)
$phpmailer->SMTPAuth = true;
// SMTP port number normally 25
$phpmailer->Port = '25';
// Username to use for SMTP authentication
#!/usr/bin/env bash
function BEFORE_PS1 {
printf "\e[32m[\e[0m$(whoami)\e[32m]@[\e[0mlocal\e[32m][\e[0m${PWD/#$HOME/~}\e[32m]$(gitPS1)\e[0m"
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(png|gif|jpg|jpeg))$1 [NC,P,L]
# Download from repository into your plugins folder
# Make sure you have wp-cli installed (otherwise it won't work)
# Add config line to wp-config.php:
# define( 'EP_HOST', '' );
# In your docroot (WordPress root folder)
wp plugin activate elasticpress --network
# Install on ubuntu trusty tahr 14.04
# I do this with root user, but if you sudo access with your user it will work too!
sudo su
# Update apt-get
apt-get update
# Install java jdk 7 or java jdk 8 or oracle jdk
apt-get install openjdk-7-jre-headless
# Make sure java is installed
java -version
# This should output: java version "1.7.XX"
jonathanbardo / plugin_extends.php
Last active Feb 11, 2016
Override/Extends a plugin
View plugin_extends.php
* Plugin Name: Extend a plugin
* Version: 0.0.1
* Author: Jonathan Bardo
* License: GPLv2+
* Author URI:
if ( ! class_exists( 'Date_Range_Filter' ) ) {
You can’t perform that action at this time.