Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh -x
# Exit if any error is encountered:
set -o errexit
# git name-rev is fail
# Get the branch name and replace the string from an array of values for instance "feature/" with "archive/"
CURRENT=`git branch | grep '\*' | awk ' {print $2}'`
ARCHIVE=`git branch | grep '\*' | awk ' {print $2}' | sed 's,.*[a-z]/,,g' | sed 's,^,archive/,g'`
#Check if we are on master or develop since we don't want to tag those
if [ $CURRENT = 'master' ]
joshlevinson / index.html
Created Jan 27, 2016
Google Plus Comments
View index.html
<script src=""></script>
gapi.comments.render('comments', {
href: window.location,
width: '760',
first_party_property: 'BLOGGER',
joshlevinson / eight-day-week-filters.php
Created Nov 6, 2015
Sample Eight Day Week filters for the Observer
View eight-day-week-filters.php
add_filter( 'Eight_Day_Week\Plugins\Article_Export\xml_outer_elements', function( $elements, $article ) {
$elements['subHeadline'] = get_post_meta( $article->ID, 'nyo_dek', true );
return $elements;
}, 10, 2 );
add_filter( 'Eight_Day_Week\Plugins\Article_Export\xml_outer_elements', function( $elements, $article ) {
if( function_exists( '\Eight_Day_Week\Plugins\Article_Byline\get_article_byline' ) ) {
$elements['byline'] = \Eight_Day_Week\Plugins\Article_Byline\get_article_byline( $article );
joshlevinson / query.php
Created Nov 3, 2015
Better -1 posts_per_page for WP Query
View query.php
$posts_per_page = 100;
$page = 1;
do {
$posts = get_posts( [
'posts_per_page' => $posts_per_page,
'paged' => $page,
] );
joshlevinson / WP CLI
Last active Dec 30, 2016
Create new VVV sites with WP CLI + wildcard hosts
vagrant ssh
cd /srv/www/
mkdir site-name && cd site-name && mkdir htdocs && cd htdocs
wp core download
wp core config --dbname=site-name --dbuser=root --dbpass=root
wp db create
wp core install --title=Site --admin_user=admin --admin_pass=password
joshlevinson / To create a new site
Last active Apr 14, 2016
Creating a VVV site with no down time
View To create a new site
vagrant ssh
cd /srv/www/
mkdir site-name && cd site-name && mkdir htdocs && cd htdocs
wp core download
wp core config --dbname=site-name --dbuser=root --dbpass=root
# Before you install the site, you'll need to create the DB. I just pull up phpMyAdmin and create it there.
wp core install --title=Site --admin_user=admin --admin_pass=password
# Create the files "vvv-hosts" and "vvv-nginx.conf"
View fixed-block.js
(function () {
define('redesign/ninemsn/portal/news/stickyElementController',['jquery', 'redesign/ninemsn/portal/news/helper'], function ($, helper) {
var bufferY = 56; // Offset for fixed positioning
var windowTop,
joshlevinson / .bash_profile
Last active Oct 28, 2020
WP CLI + Xdebug
View .bash_profile
# Add this to /config/bash_profile
function wpd {
export XDEBUG_CONFIG="idekey=VVVDEBUG remote_connect_back=1"
wp "$@"
# Run these commands:
# vagrant ssh
# sudo cp /srv/config/bash_profile /home/vagrant/.bash_profile
# source ~/.bash_profile
View gist:1f451a039e357fad2fc6
/* jshint esnext: true */
import Ember from 'ember';
// When mixed into an Ember.Component class, actions can be explicitly or implicitly delegated to the parent.
// In general this makes the most sense for an app-level component, where actions are not mututated as they bubble
// up to higher levels.
export default Ember.Mixin.create({
// When true, all actions will be implicitly passed on to the parent
joshlevinson / ra-export.php
Created Oct 7, 2014
Modified Advanced Export for WP & WPMU to Export by Tag
View ra-export.php
Plugin Name: Advanced Export
Plugin URI:
Description: Adds an Advanced Export to the Tools menu which allows selective exporting of pages, posts, specific categories and/or post statuses by date.
Version: 2.9
Author: Ron Rennick
Author URI: