Register TinyMCE Plugin and Button

add_filter( 'mce_external_plugins', 'plugin_slug_add_button' );
function plugin_slug_add_button( $plugins ) {
	$plugins['plugin_slug'] = 'path/to/editor/plugin.js';
	return $plugins;
}

add_filter( 'mce_buttons', 'plugin_slug_register_button' );
function plugin_slug_register_button( $buttons ) {
	array_push( $buttons, 'plugin_slug' );
	return $buttons;
}

TinyMCE Button Plugin

( function() {

	// Register plugin
	tinymce.create( 'tinymce.plugins.plugin_slug', {

		init: function( editor, url )  {

			// Add the Insert Gistpen button
			editor.addButton( 'plugin_slug', {
				//text: 'Insert Shortcode',
				icon: 'icons dashicons-icon',
				tooltip: 'Insert Shortcode',
				cmd: 'plugin_command'
			});

			// Called when we click the Insert Gistpen button
			editor.addCommand( 'plugin_command', function() {
				// Calls the pop-up modal
				editor.windowManager.open({
					// Modal settings
					title: 'Insert Shortcode',
					width: jQuery( window ).width() * 0.7,
					// minus head and foot of dialog box
					height: (jQuery( window ).height() - 36 - 50) * 0.7,
					inline: 1,
					id: 'plugin-slug-insert-dialog',
					buttons: [{
						text: 'Insert',
						id: 'plugin-slug-button-insert',
						class: 'insert',
						onclick: function( e ) {
							insertShortcode();
						},
					},
					{
						text: 'Cancel',
						id: 'plugin-slug-button-cancel',
						onclick: 'close'
					}],
				});

				appendInsertDialog();

			});

		}

	});

	tinymce.PluginManager.add( 'plugin_slug', tinymce.plugins.plugin_slug );

	function appendInsertDialog () {
		var dialogBody = jQuery( '#plugin-slug-insert-dialog-body' ).append( '[Loading element like span.spinner]' );

		// Get the form template from WordPress
		jQuery.post( ajaxurl, {
			action: 'plugin_slug_insert_dialog'
		}, function( response ) {
			template = response;

			dialogBody.children( '.loading' ).remove();
			dialogBody.append( template );
			jQuery( '.spinner' ).hide();
		});
	}
})();

Algo to pick every item from array once

		$num_posts = count( $languages );

		$this->gistpens = $this->factory->post->create_many( $num_posts, array(
			'post_type' => 'gistpens',
		), array(
			'post_title' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ),
			'post_name' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ),
			'post_content' => new WP_UnitTest_Generator_Sequence( 'Post content %s' )
		));

		foreach ( $this->gistpens as $gistpen_id ) {
			// Pick a random language
			$num_posts = $num_posts - 1;
			$lang_num = rand( 0, ( $num_posts ) );

			// Get the language's id
			$lang_id = $languages[$lang_num];

			// Remove the language and reindex the languages array
			unset( $languages[$lang_num] );
			$languages = array_values( $languages );

PHP Version check for WP Boilerplate

public static function activate() {
	if ( ! version_compare( PHP_VERSION, '5.3', '<' ) ) {
		return;
	}

	deactivate_plugins( 'url-embedlifier' );
	wp_die('<p>The <strong>URL Embedlifier</strong> plugin requires PHP version 5.3 or greater.</p>',
		'Plugin Activation Error',  array( 'response' => 200, 'back_link' => true ) );
}

Default Classes for WP-Gistpen

<?php
namespace WP_Gistpen;

/**
 * This is the class description.
 *
 * @package    WP_Gistpen
 * @author     James DiGioia <jamesorodig@gmail.com>
 * @link       http://jamesdigioia.com/wp-gistpen/
 * @since      [current version]
 */
class Boilerplate {

	/**
	 * The ID of this plugin.
	 *
	 * @since    [current version]
	 * @access   private
	 * @var      string    $plugin_name    The ID of this plugin.
	 */
	private $plugin_name;

	/**
	 * The version of this plugin.
	 *
	 * @since    [current version]
	 * @access   private
	 * @var      string    $version    The current version of this plugin.
	 */
	private $version;

	/**
	 * Initialize the class and set its properties.
	 *
	 * @since    [current version]
	 * @var      string    $plugin_name       The name of this plugin.
	 * @var      string    $version    The version of this plugin.
	 */
	public function __construct( $plugin_name, $version ) {

		$this->plugin_name = $plugin_name;
		$this->version = $version;

	}
}
<?php

class WP_Gistpen_Sample_Test extends WP_Gistpen_UnitTestCase {

	function setUp() {
		parent::setUp();
	}

	function test_sample() {
		// replace this with some actual testing code
		$this->markTestIncomplete( "This test is incomplete." );
	}

	function tearDown() {
		parent::tearDown();
	}
}

Sync additional paths in Bedrock-Ansible’s Vagrantfile

# Sync additional paths
extra_paths = [
  ['../../../plugins/wp-gistpen', File.join(bedrock_path_server, 'web/app/plugins/wp-gistpen')]
]

extra_paths.each do |paths|
  extra_path = paths[0]
  extra_path_server = paths[1]
  initial_mount = File.join('/wptmp', File.basename(extra_path))

  if Vagrant::Util::Platform.windows?
    config.vm.synced_folder extra_path, extra_path_server, owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775']
  else
    if !Vagrant.has_plugin? 'vagrant-bindfs'
      raise Vagrant::Errors::VagrantError.new,
        "vagrant-bindfs missing, please install the plugin:\nvagrant plugin install vagrant-bindfs"
    else
      config.vm.synced_folder extra_path, initial_mount, type: 'nfs'
      config.bindfs.bind_folder initial_mount, extra_path_server, u: 'vagrant', g: 'www-data'
    end
  end
end

Git-to-SVN Plugin Deploy by Scribu

#!/usr/bin/env bash

# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}

# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/$DIR_NAME/$BRANCH

# build first
if [ -f "$SRC_DIR/bin/build" ]; then
	$SRC_DIR/bin/build
fi

# make sure we're deploying from the right dir
if [ ! -d "$SRC_DIR/.git" ]; then
	echo "$SRC_DIR doesn't seem to be a git repository"
	exit
fi

# make sure the destination dir exists
mkdir -p $DEST_DIR
svn add $DEST_DIR 2> /dev/null

# delete everything except .svn dirs
for file in $(find $DEST_DIR/* -type -f -and -not -path "*.svn*")
do
	rm $file
done

# copy everything over from git
rsync --recursive --exclude='*.git*' $SRC_DIR/* $DEST_DIR

cd $DEST_DIR

# check .svnignore
for file in $(cat "$SRC_DIR/.svnignore" 2> /dev/null)
do
	rm -rf $DEST_DIR/$file
done

# Transform the readme
if [ -f README.md ]; then
	mv README.md readme.txt
	sed -i '' -e 's/^# (.*)$/=== 1 ===/' -e 's/ #* ===$/ ===/' -e 's/^## (.*)$/== 1 ==/' -e 's/ #* ==$/ ==/' -e 's/^### (.*)$/= 1 =/' -e 's/ #* =$/ =/' readme.txt
fi

# svn addremove
svn stat | awk '/^?/ {print $2}' | xargs svn add > /dev/null 2>&1
svn stat | awk '/^!/ {print $2}' | xargs svn rm --force

svn stat

svn ci -m "$MSG"
#!/bin/bash

if [ $# -lt 1 ]; then
	echo 'usage: plugin-tag 1.2.3'
	exit
fi

TAG_NAME=$1

git tag $TAG_NAME
git push
git push --tags

plugin-deploy "tagging version $TAG_NAME" tags/$TAG_NAME