Skip to content

Instantly share code, notes, and snippets.

@eddieajau
eddieajau / PSR-1.md
Created May 4, 2012 23:29
PSR-1,2 Combined variant

PSR-1 PHP Code Style Standard

Version: 1 2012-05-??

This standard comprises the code style requirements for interoperability (Section 1) and the best practices guidelines (Section 2) for PHP projects.

O Definitions

studly-caps refers to a naming convention where all 'words' in the name are conactenated and have only the first letter in uppercase followed by lower case letters (for example "StudlyCaps").

@eddieajau
eddieajau / gist:2505017
Created April 27, 2012 01:57
A class method that can be used to import a CSV file of any size using SplFileObject.
/**
* Import a CSV file.
*
* @param string $fileName The name of the file to import. If omitted, the state is used.
* @param integer $offset The number of lines/rows to ignore (default = 0).
*
* @return void
*
* @since 1.0
* @throws InvalidArgumentException if file name is invalid or does not exist.
@eddieajau
eddieajau / database_iterator.php
Created February 21, 2012 07:28
Joomla Database Iterator
<?php
/**
* @package Joomla.Platform
* @subpackage Database
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
@eddieajau
eddieajau / date.php
Created September 20, 2011 22:10
Joomla platform JHtmlDate::ago concept
class JHtmlDHDate
{
/**
* Outputs a relative time.
*
* @param mixed $date A string or DateTime object representing the time in the past to compare to now.
*
* @return string
*
* @since 1.0.1