Skip to content

Instantly share code, notes, and snippets.

View andrewwoods's full-sized avatar

Andrew Woods andrewwoods

View GitHub Profile
@andrewwoods
andrewwoods / base-wallpaper.php
Last active December 1, 2022 04:30
Create wallpapers with random patterns for your desktop.
<?php
/**
* The base class for all Wallpaper subclasses
*
* @package Wallpapers
* @access public
*/
class BaseWallpaper {
/** a handle to the image */
### 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 <[email protected]>
*
@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 / .gitignore
Last active February 1, 2016 03:47
WordPress Site Gitignore Boilerplate
# Common wordpress files to ignore
wp-config.php
wp-content/debug.log
wp-content/advanced-cache.php
wp-content/wp-cache-config.php
# Common wp-content directories
wp-content/backup-db/
@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 / 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 / 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);