Skip to content

Instantly share code, notes, and snippets.

View philbirnie's full-sized avatar

Phil Birnie philbirnie

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Adept_Catlanding>
<active>true</active>
<codePool>local</codePool>
</Adept_Catlanding>
</modules>
</config>
@philbirnie
philbirnie / config.xml
Last active August 29, 2015 13:55
Adept_Catlanding Congifuragion
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Adept_Catlanding>
<!-- Make sure that the version number matches the filename on your install script! -->
<version>0.3.0</version>
</Adept_Catlanding>
</modules>
<global>
<resources>
@philbirnie
philbirnie / mysql4-install-0.3.0.php
Created January 30, 2014 16:13
Installation file for custom category field
<?php
$installer = $this;
$installer->startSetup();
/**
* This is an entity associated with catalog_category
* @var integer
*/
$entityTypeId = $installer->getEntityTypeId('catalog_category');
@philbirnie
philbirnie / tabs.js
Last active August 29, 2015 14:01
Barebones Tabs switcher
/*jslint browser: true*/
/*global jQuery */
/*---------------------------------------------------------------
* Barebones Tabs Class
*
* Requires jQuery
*
* Markup:
* - Tab elements should have class "tab" with a data-tabref="x"
@philbirnie
philbirnie / quickbrick.js
Created May 21, 2014 13:44
Dead simple position mover for an element or two to keep everything tidy
/*jslint browser: true*/
/*global jQuery */
var QuickBrick = {
topEntity: null,
bottomEntity: null,
@philbirnie
philbirnie / custom_post_demo.php
Last active August 29, 2015 14:07
Custom Post Boilerplate
<?php
/*
Plugin Name: BBB - Videos
Plugin Uri: URI
Description: Custom Field Type Video
Author: Phil Birnie
Version 0.9
Author Uri: http://mindstreaminteractive.com
*/
@philbirnie
philbirnie / ShopProduct.php
Last active August 29, 2015 14:27
PHP Book - The Class
<?php
/* A class is used to create an object - an object is defined by a class */
class ShopProduct {
/** Properties **/
public $title = 'Default Product';
public $producer_last = 'Last Name';
@philbirnie
philbirnie / ConflictExample.php
Created November 11, 2015 02:23
PHP Book insteadof and as.
<?php
/**
* If two traits share the same method and are both included in a class, we have a problem. Rare, but possible
* Here's how to get around it.
*
* Reference: PHP Objects, Patterns and Practice, ed 4. pp 49
**/
trait TaxTools {
function calculateTax($price) {
@philbirnie
philbirnie / PriceUtilities.php
Last active November 11, 2015 02:31
PHP Book - The Trait
<?php
/**
*
* Traits
*
* 1. PHP does not allow for multiple inheritance
* 2. A class can implement many interfaces, but interfaces only provide a template.
* 3. Traits allow us to share implementation across class hierarchies.
*
@philbirnie
philbirnie / cms.xml
Last active December 11, 2015 12:08
An example of how to properly add additional links in Magento
<layout version="0.1.0">
<default>
<reference name="top.links">
<action method="addLink" translate="label title" module="page">
<label>About</label>
<url>about-us</url>
<prepare>true</prepare> <!-- This is necessary if we are going to add the base URL -->
<title>About</title>
<urlParams />
<position>90</position>