Skip to content

Instantly share code, notes, and snippets.

mkdir quickstart
cd quickstart
vagrant box add base http://files.vagrantup.com/lucid32.box
vagrant init
vagrant up
vagrant ssh
# Do all of this where you'd like the project to live
git clone https://github.com/10up/varying-vagrant-vagrants.git project-name
cd project-name
vagrant up
@aaroneaton
aaroneaton / new-repo.php
Created November 17, 2013 00:38
gitolite command to setup a new repository for building and pushing to WP Engine.
#!/usr/bin/php
<?php
// Get the repo name
$repo = $argv[1];
$type = $argv[2] . 's';
file_put_contents( '/home/git/triggered', "The $repo repository was created");
// Make the required directories
@aaroneaton
aaroneaton / post-update.php
Created November 17, 2013 00:39
Pushes the repo to the correct WP Engine installs.
#!/usr/bin/php
<?php
/* Begin Variables */
// Get the repo name
$path = exec("pwd");
$repo = basename($path, ".git");
// Get the branch name
@aaroneaton
aaroneaton / alpha-listing.php
Created November 17, 2013 20:24
Creates an alphabetical listing of posts with anchors.
echo '<p class="alphabet">';
foreach ( range('A', 'Z') as $char) {
printf( '<a href="#%1$s">%1$s</a> ', $char );
}
echo '</p>';
//loop through posts
global $posts;
foreach( $posts as $post ) {
$this_char = strtoupper( substr( $post->post_title, 0, 1 ) );
@aaroneaton
aaroneaton / composer.json
Last active May 13, 2018 00:55
Include the WordPress unit tests as a Composer package
"repositories": [
{
"type" : "package",
"package": {
"name": "wordpress/unit-tests",
"version": "1.0",
"source" : {
"type": "svn",
"url": "http://unit-tests.svn.wordpress.org",
"reference": "trunk"
@aaroneaton
aaroneaton / new-site.sh
Last active August 29, 2015 13:57
Quickly add a new WP install to your server
#! /bin/sh
# This script assumes a few things
# 1. You are running Nginx
# 2. WP-CLI is installed
# 3. Your user is part of the www-data group
# 4. Nginx_ensite is installed (https://github.com/perusio/nginx_ensite)
# 5. nginx-wp-common.conf is installed at `/etc/nginx/nginx-wp-common.conf`
# How to use
@aaroneaton
aaroneaton / limit-optin-view.php
Last active August 29, 2015 14:03
Limits the number of times an optin can be viewed
<?php
add_filter( 'optinmonster_output', 'limit_views' );
function limit_views ( $optins ) {
// Replace this with your optin slug
$optin_slug = 'yf3rluqqcj-lightbox';
// Replace this with the number of views
$view_limit = 100;
@aaroneaton
aaroneaton / sample.php
Last active August 29, 2015 14:07
create addon
<?php
add_action( 'plugins_loaded', 'om_sample_plugins_loaded' );
function om_sample_plugins_loaded() {
// Bail if the main class does not exist.
if ( ! class_exists( 'Optin_Monster' ) ) {
return;
}
@aaroneaton
aaroneaton / sample.php
Created September 30, 2014 21:20
create plugin
<?php
/**
* Plugin Name: OptinMonster Sample Theme
* Plugin URI: http://optinmonster.com/
* Description: OptinMonster is the best lead generation plugin for WordPress.
* Author: OptinMonster Developers
* Author URI: http://optinmonster.com
* Version: 1.0
* Text Domain: optin-monster-sample-theme
* Domain Path: languages