Skip to content

Instantly share code, notes, and snippets.

View philsturgeon's full-sized avatar
🌳
Planting Trees

Phil Sturgeon philsturgeon

🌳
Planting Trees
View GitHub Profile

Treeware

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 offset.earth/treeware

Read more about Treeware at treeware.earth

@philsturgeon
philsturgeon / gearman-workers.sh
Created January 16, 2012 01:53 — forked from fabriziomachado/gearman-workers.sh
/etc/init.d/gearman-workers
#!/bin/bash
#
# /etc/init.d/gearman-workers
### BEGIN INIT INFO
# 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
philsturgeon / example.php
Created March 16, 2016 18:27 — forked from anonymous/example.php
Instance variable type checking needed?
<?php
class Example
{
public $number;
public $text;
public function __construct(int $number, string $text)
{
$this->number = $number;
@philsturgeon
philsturgeon / TwitterHighlights.snippet.php
Created June 23, 2012 18:19
MODX Revolution Output filter to create links from Twitter @name, #tag and URLs
<?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=\"https://www.twitter.com/\\1\" rel=\"nofollow\">@\\1</a>", $input);
$input = preg_replace("/#(\w+)/", "<a href=\"https://www.twitter.com/search/\\1\" rel=\"nofollow\">#\\1</a>", $input);
@philsturgeon
philsturgeon / gist:1529194
Created December 28, 2011 19:03 — forked from adamfairholm/gist:1397939
PyroCMS Example Module details.php
<?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(
<?php
// Need to add 'activerecord' to your packages in config.php
namespace Fuel\Application;
use ActiveRecord;
class Model_User extends ActiveRecord\Model {}