Skip to content

Instantly share code, notes, and snippets.

View voodooGQ's full-sized avatar

Shane Smith voodooGQ

View GitHub Profile
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@wilmoore
wilmoore / SplClassLoader.php
Created June 5, 2010 04:25 — forked from jwage/SplClassLoader.php
PHP 5.3 Namespace Autoloader
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@jakebellacera
jakebellacera / ICS.php
Last active June 2, 2024 02:20
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@stevenh512
stevenh512 / .gitignore
Created May 22, 2012 21:23
GitHub Authorizations API for command line apps using Octokit
Gemfile.lock
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@apticknor
apticknor / css-stats-ack.sh
Last active April 26, 2023 15:48 — forked from pjkix/css-stats-ack.sh
shell script to generate some css file statistics
#!/bin/bash
## Generate CSS Statistics and determine the health of your css
##
## Usage
## bash /path/to/css-stats-ack.sh
## bash /path/to/css-stats-ack.sh > file.txt
##
## TODO - add support for SCSS
##
@sscovil
sscovil / plugin-class-autoloader.php
Last active December 20, 2015 08:09
This class autoloader function eliminates the need to include_once every class file in your WordPress plugin. It adheres to WordPress file naming conventions, so instantiating a class named MyClass would attempt to include_once a file called inc/class-myclass.php.
<?php
/**
* Plugin Name: My Plugin
* Description: A sample plugin with class autoloader, for object-oriented programming.
* Version: 0.1
* Plugin URI: http://shaunscovil.com/
* Author: Shaun Scovil
* Author URI: http://shaunscovil.com/
* License: GPL2
*/
@RealShermanB
RealShermanB / CurrentTemplateName.php
Last active December 20, 2015 18:39
I seem to need this code all the time. It creates a function for displaying which wordpress theme template is currently being used.
<?php
/**
* Add to your functions.php
* from here: http://wordpress.stackexchange.com/questions/10537/get-name-of-the-current-template-file
*/
add_filter( 'template_include', 'var_template_include', 1000 );
function var_template_include( $t ){
$GLOBALS['current_theme_template'] = basename($t);
return $t;
@RealShermanB
RealShermanB / MultiDomainContent.php
Last active December 30, 2015 03:48
Allow a single wordpress install to serve different content to different domains. This is version 0.0.0.0.1
<?php
/**
* This part resides in wp-config and is used to assign the domains
*
*/
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
function domain_theme($domain) {
define('WP_SITEURL', 'http://'.$domain);
@Integralist
Integralist / rules for good testing.md
Last active May 13, 2024 18:25
Sandi Metz advice for writing tests

Rules for good testing

Look at the following image...

...it shows an object being tested.

You can't see inside the object. All you can do is send it messages. This is an important point to make because we should be "testing the interface, and NOT the implementation" - doing so will allow us to change the implementation without causing our tests to break.