Skip to content

Instantly share code, notes, and snippets.

View andrewwoods's full-sized avatar

Andrew Woods andrewwoods

View GitHub Profile
### Keybase proof
I hereby claim:
* I am andrewwoods on github.
* I am awoods (https://keybase.io/awoods) on keybase.
* I have a public key whose fingerprint is 6FAE A355 37B1 9509 CB9A 102F C9CA 6422 EBB1 3F8A
To claim this, I am signing this object:
@andrewwoods
andrewwoods / passwd-gen.php
Last active August 29, 2015 14:09
Password Generator by Pattern
#!/usr/bin/php
<?php
/**
* Generate a password based on a pattern
*
* @package Command Line
* @subpackage Utilities
* @version 1.0
* @author Andrew Woods <atwoods1@gmail.com>
*
@andrewwoods
andrewwoods / create.user.sql
Created November 16, 2014 17:42
A script to create a mysql user.
-- Removing the keyword PASSWORD will set the password in plain text.
CREATE USER 'wp'@'%' IDENTIFIED BY 'password';
--
-- Assign permissions to the user you just created
--
GRANT
@andrewwoods
andrewwoods / wp-config.php
Last active August 29, 2015 14:09
WordPress Config File wp-config.php
<?php
/**
* The base configurations of the WordPress.
*
* <ENVIRONMENT> Environment
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
@andrewwoods
andrewwoods / MyWidget.php
Created January 7, 2015 18:30
WordPress Widget Boilerplate
<?php
add_action( 'widgets_init', 'register_my_widget' );
class My_Widget extends WP_Widget
{
function __construct() {
$widget_options = array(
'classname' => 'my-widget-class'
@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
@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 / 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 / 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 / .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