Skip to content

Instantly share code, notes, and snippets.

View andrewwoods's full-sized avatar

Andrew Woods andrewwoods

View GitHub Profile
@andrewwoods
andrewwoods / synopsis.txt
Last active November 3, 2016 17:37
Customize a Vagrant Environment
I want to create an Vagrant environment I can use for local development. It's
for a framework-less PHP project, that needs to be developed for specific PHP
versions. To begin, I need to use PHP 5.2.2.
I have my code in ~/client/src on my Mac and need to sync this folder to the
webroot on the VM using VirtualBox 4.3.10 and Vagrant 1.7.4.
I use PHPStorm for development.
I'll soon want to add virtual guest machines, each with their own PHP version

Project Name

The project tagline is cool and witty

This is where you write a paragrah or so describing your project to the person reading it knows what your project is all about. You could skip this part but after all the hard work you put into creating your project, it would be a shame if nobody ever used it, because you didn't take the time to explain it to them. You don't have to write a lot - just enough to get them interested.

@andrewwoods
andrewwoods / resources.md
Last active December 16, 2016 16:15
PHP resources

PHP Resources

This gist has been converted to a repository called PHP Resoures Repo that you can fork and pull request to your heart's content!

May your coffee always be warm, your code always work, and the force be with you

@andrewwoods
andrewwoods / vvv-bashrc
Created October 26, 2015 03:37
VVV - Create corresponding path for your vagrant box
# I'm using VVV. Let's say I have a really long path like
#
# /Users/awoods/vagrant-local/www/project-site/public_html/wp-content/plugins/my-plugin
#
# If I 'vagrant ssh' into the host and want to cd to the corresponding path
# it's a pain to have to type in a really long path like
#
# /srv/www/project-site/public_html/wp-content/plugins/my-plugin
#
# This function gets your current path, and return the corresponding
@andrewwoods
andrewwoods / .git-commitmessage
Last active September 18, 2015 21:21
Custom Git Commit Message
Subject line
Describe what you did and why
[ticket: #X]
#------------------------------------------------@----------------------
#
# * Separate subject from body with a blank line
# * Limit the subject line to 50 characters
@andrewwoods
andrewwoods / install_plugins.bash
Created July 22, 2015 01:23
Install a list of WordPress Plugins
#
# wp_install_plugins
#
# $ wp_install_plugins ~/wp-plugins.txt
#
# text file with a list of wordpress.org plugin slugs. one per line.
#
function wp_install_plugins
{
@andrewwoods
andrewwoods / wp_install.bash
Last active August 29, 2015 14:25
Install and Configure WordPress using WP-CLI
#
# wp_install - download wordpress, install, and configure it.
#
# $ wp_install <dirname>
#
function wp_install
{
wp core download --path=$1
cd $1
read -p 'name the database:' dbname
@andrewwoods
andrewwoods / plugin-autoloader.php
Created June 24, 2015 23:18
WordPress Plugin Autoloader
/*
* Include this in your primary plugin file
*
* Create a 'classes' directory in your plugin directory.
* To load a class nameed So_Awesome, it should be in classes/class-so-awesome.php
*/
function your_plugin_autoloader( $class_name ) {
$slug = sanitize_title_with_dashes( $class_name, '', 'save' );
$slug = str_replace('_', '-', $slug);
@andrewwoods
andrewwoods / js-oop-example.txt
Created May 22, 2015 20:25
JS OOP inheritance idea
Source URL http://www.sitepoint.com/simple-inheritance-javascript/
This article makes inheritance in OOP easy to understand.
It did get me thinking. In the article above, the author uses
var inheritsFrom = function (child, parent) {
child.prototype = Object.create(parent.prototype);
};
@andrewwoods
andrewwoods / rick-roll.html
Created February 15, 2015 06:27
Rick Roll
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rick Roll Example</title>
<script>
document.addEventListener( "DOMContentLoaded", function( event ) {
// Sun=0
// Mon=1