Skip to content

Instantly share code, notes, and snippets.

View jonathanbardo's full-sized avatar

Jonathan Bardo jonathanbardo

View GitHub Profile
@jonathanbardo
jonathanbardo / theme.js
Created October 7, 2021 17:55
theme.json generator
// To run: node theme.js
const fs = require('fs');
const theme = {
"settings": {
"typography": {
"fontSizes": [
// This is a comment.
{
"name": "Large",
@jonathanbardo
jonathanbardo / __return.php
Last active December 11, 2016 14:25
If WordPress required PHP >= 5.3
<?php
if ( ! function_exists( '__return' ) ) {
function __return( $return ) {
return function() use ( $return ) {
return $return;
@jonathanbardo
jonathanbardo / dnsmasq
Last active July 13, 2016 20:10
dnsmasq setup on mac os x 10.11
# using .domain to 127.0.0.1
echo 'address=/.domain/127.0.0.1' >> /usr/local/etc/dnsmasq.conf
# make sure the file name in /etc/resolver is the same as your domain
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/domain'
# restart dnsmasq
sudo brew services restart dnsmasq
@jonathanbardo
jonathanbardo / reverse-wpautop.php
Last active December 29, 2018 20:00
Opposite of wpautop
<?php
/**
* Do the opposite of wpautop
*
* @param string $s
*
* @return string
*/
public static function reverse_wpautop( $s ) {
@jonathanbardo
jonathanbardo / mac_xwindows_x11_xvfb_headless_firefox_howto.md
Created March 15, 2016 16:32 — forked from textarcana/mac_xwindows_x11_xvfb_headless_firefox_howto.md
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
jonathanbardo / email.php
Last active August 29, 2015 14:16
Send email using WordPress
function smtp_mail( $phpmailer ) {
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// 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
@jonathanbardo
jonathanbardo / beforePS1.sh
Last active August 29, 2015 14:16
GIT PS1
#!/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"
}
@jonathanbardo
jonathanbardo / .htaccess
Last active August 29, 2015 14:15 — forked from brichards/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(png|gif|jpg|jpeg)) http://example.com/$1 [NC,P,L]
</IfModule>
@jonathanbardo
jonathanbardo / install_elasticpress.sh
Last active January 15, 2016 03:41
Install Elasticpress
# Download from wordpress.org repository into your plugins folder
# https://wordpress.org/plugins/elasticpress/
# Make sure you have wp-cli installed (otherwise it won't work) http://wp-cli.org/
# Add config line to wp-config.php:
# define( 'EP_HOST', 'http://127.0.0.1:9200' );
# In your docroot (WordPress root folder)
wp plugin activate elasticpress --network
@jonathanbardo
jonathanbardo / install_elasticsearch.sh
Last active January 15, 2016 03:41
Install Elasticsearch
# 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"