Skip to content

Instantly share code, notes, and snippets.

View matgargano's full-sized avatar

Mat Gargano matgargano

View GitHub Profile
@matgargano
matgargano / gist:fea6c14f694f724a8c6d
Created July 2, 2014 13:26
add local ssh key to remote server
cat ~/.ssh/id_rsa.pub | ssh root@your.ip.address "cat >> ~/.ssh/authorized_keys"
<?php
add_action( 'add_meta_boxes', function() {
add_meta_box( 'asdf123_editors', 'Editors', function() {
wp_editor( 'Drag/Drop => True', 'asdf123_editor_1', array(
'drag_drop_upload' => true,
) );
function get_current_post_type() {
global $post, $typenow, $current_screen, $pagenow;
if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
if ( $post && $post->post_type ) {
return $post->post_type;
}
<?php
class Easy_Weather_Widget_Settings {
private $option_name = 'eww_settings';
private $option_value = null;
function __construct() {
@matgargano
matgargano / gist:8b664923e59846e44d40
Created August 7, 2014 12:54
Prevent Rich Text From Being Pasted TinyMCE 4X
tinymce.init({
plugins: "paste",
paste_as_text: true
});
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
@matgargano
matgargano / install-wp-tests.sh
Last active August 29, 2015 14:06
updated install wordpress testing bash script
#!/usr/bin/env bash
if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
exit 1
fi
DB_NAME=$1
DB_USER=$2
<?php
/**
* Implements register_wpmdbpro command.
*/
class MDB_Pro_Command extends WP_CLI_Command {
/**
* Registers WP Migrate DB Pro.
*
* ## OPTIONS
<?php
class Demo_Plugin_Test extends WP_UnitTestCase {
function test_init() {
$demo_plugin = $this->getMockBuilder( 'Demo_Plugin' )
->disableOriginalConstructor()
->setMethods( 'attach_hooks' )
->getMock();
<?php
/*
Plugin Name: Unit Testing Demo Plugin
Plugin URI: http://example.com
Description: Let's get started unit testing
Author: Me
Version: 0.1
Author URI: http://example.com
*/