Skip to content

Instantly share code, notes, and snippets.

Working from home

Phil Sturgeon philsturgeon

Working from home
View GitHub Profile


You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees here

Read more about Treeware at

philsturgeon / example.php
Created Mar 16, 2016 — forked from anonymous/example.php
Instance variable type checking needed?
View example.php
class Example
public $number;
public $text;
public function __construct(int $number, string $text)
$this->number = $number;
philsturgeon / TwitterHighlights.snippet.php
Created Jun 23, 2012
MODX Revolution Output filter to create links from Twitter @name, #tag and URLs
View TwitterHighlights.snippet.php
* TwitterHighlights
* Output filter to create links from Twitter @name, #tag and URLs
$input = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" rel=\"nofollow\">\\2</a>", $input);
$input = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" rel=\"nofollow\">\\2</a>", $input);
$input = preg_replace("/@(\w+)/", "<a href=\"\\1\" rel=\"nofollow\">@\\1</a>", $input);
$input = preg_replace("/#(\w+)/", "<a href=\"\\1\" rel=\"nofollow\">#\\1</a>", $input);
# /etc/init.d/gearman-workers
# Provides: gearman-workers
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
philsturgeon / gist:1529194
Created Dec 28, 2011 — forked from adamfairholm/gist:1397939
PyroCMS Example Module details.php
View gist:1529194
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Module_Sample extends Module {
public $version = '2.0';
public function info()
return array(
'name' => array(
View user.php
// Need to add 'activerecord' to your packages in config.php
namespace Fuel\Application;
use ActiveRecord;
class Model_User extends ActiveRecord\Model {}
You can’t perform that action at this time.