Skip to content

Instantly share code, notes, and snippets.

@eddieajau
eddieajau / packaging.xml
Created January 28, 2013 01:44
Eclipse snippet category for packaging Joomla extensions. Includes: Basic installer class, SQL installation file header, XML installation supplement, XML administrator files, XML build file. Updated 2013-01-24
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<snippets>
<category filters="*" id="category_1311161288555" initial_state="1" label="Packaging" largeicon="" smallicon="">
<description><![CDATA[Snippets to assist with creating extension packages for distribution.]]></description>
<item category="category_1311161288555" class="" editorclass="" id="item_1311161491543" label="Basic installer class" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[The basic installer class that can be created in a installer.php file in the main directory of the extension.]]></description>
<content><![CDATA[/**
* @package ${PACKAGE}
* @subpackage ${SUBPACKAGE}
* @since ${SINCE}
@eddieajau
eddieajau / joomla_plugins.xml
Created January 28, 2013 01:37
Eclipse snippet category for Joomla plugins. Includes: Master Plugin File, XML Installation File (Plugin), Plugin method, Trigger plugin. Updated 2013-01-24
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<snippets>
<category filters="*" id="category_1278465230540" initial_state="1" label="Joomla Plugins" largeicon="" smallicon="">
<description><![CDATA[Snippets specifically for support Joomla modules.]]></description>
<item category="category_1278465230540" class="" editorclass="" id="item_1278465575233" label="Master Plugin File" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[Unnamed Template]]></description>
<content><![CDATA[jimport('joomla.plugin.plugin');
/**
* ${GROUP} ${NAME} Plugin.
@eddieajau
eddieajau / gist:4980010
Last active December 13, 2015 21:48
Draft Documentation Guide

Documentation Guide

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

@eddieajau
eddieajau / test.php
Created March 11, 2013 04:32
A strategy for mocking a PSR-3 logger. This assume the class being tested has a `log` method which probably checks if the logger has been set and then proxies to `$this->logger->log`.
use Psr\Log;
class TheTest extends \PHPUnit_Framework_TestCase
{
/**
* The class we are testing.
*/
protected $instance;
/**
@eddieajau
eddieajau / DataMapper.php
Created December 2, 2013 21:44
Data mappers
<?php
/**
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Data;
use Psr\Cache\CacheInterface;
@eddieajau
eddieajau / fw_release_strategy.md
Last active December 31, 2015 11:59
Joomla Framework Release Strategy

Joomla! Framework Release Strategy

1. Introduction

1.1 Revision History

Version Date Notes
1.0.0 16 December 2013 First version
@eddieajau
eddieajau / joomla_components.xml
Created January 27, 2013 23:44
Eclipse snippet category for general purpose Joomla 2.5/3 Component snippets. Includes: * PHP File Header * XML Installation File (Component) * INI File Header * Master Component File * Master Controller * Basic View * Basic Model * Basic View with Toolbar * Basic Controller Display Override * Basic Component Helper * Basic config.xml * Basic ac…
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<snippets>
<category filters="*" id="category_1275479375591" initial_state="1" label="Joomla Components" largeicon="" smallicon="">
<description><![CDATA[Snippets that support the general needs for any Joomla component.]]></description>
<item category="category_1275479375591" class="" editorclass="" id="item_1275479460203" label="PHP File Header" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[The standard header for a PHP file.]]></description>
<content><![CDATA[<?php
/**
* @version $Id$
* @package ${PACKAGE}
class SafeObserver {
constructor(private _next: (value: any) => void = () => {},
public error: (errorValue: any) => void = (e: any) => { throw e; },
private _complete: (completeValue?: any) => void = () => {}) {}
public next(value: any) {
try {
this._next(value);
}
catch (e) {
@eddieajau
eddieajau / createSequelizeStream.js
Created March 20, 2016 22:14
Module to allow a Sequelize select query to be converted into a stream.
"use strict";
var Readable = require('stream').Readable;
/**
* Create a stream from batching a Sequelize select query.
*
* @param {Function} query - Function that returns a promise.
* @param {object} options
* @param {number} options.limit - The limit for the number of rows to return in each "batch"
@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