Skip to content

Instantly share code, notes, and snippets.

View morrisonlevi's full-sized avatar

Levi Morrison morrisonlevi

View GitHub Profile
@morrisonlevi
morrisonlevi / Tokenizer.php
Created March 20, 2012 08:14
Http Routes Tokenizer
<?php
namespace Http;
require './Token.php';
use Iterator;
use RuntimeException;
class Tokenizer implements Iterator {
@morrisonlevi
morrisonlevi / performance_array_max_recursive.php
Created August 22, 2012 18:35
Performance: array_max_recursive implementations
<?php
if (count($argv) > 1) {
define('NEST_LEVEL', $argv[1]);
define('NUMBER_OF_TEST_ITERATIONS', $argv[2]);
} else {
define('NEST_LEVEL', 50);
define('NUMBER_OF_TEST_ITERATIONS', 5);
}
@morrisonlevi
morrisonlevi / gist:4083664
Created November 16, 2012 03:13
ext/mysql deprecation email

Sirs, Gentlemen and Scholars,

I am appreciative of all of the discussion that has happened on the mysql_deprecation RFC (https://wiki.php.net/rfc/mysql_deprecation). It has helped me understand how we feel collectively about ext/mysql and how to deprecate it. I believe that clarifying what the term 'deprecation' means could help everyone to understand what we are trying to accomplish.

To quote wikipedia on the word 'deprecation':

In the process of authoring computer software, its standards or documentation, or other technical standards, deprecation is a status applied to features, characteristics, or practices to indicate that they should be avoided, typically because they have been superseded.

I think we all agree that ext/mysql should be avoided and that it has been superseded. What I want to point out is that deprecation is a process. The real question is: have we taken the proper steps in that process?

Thank you to everyone who responded, both here and in various other places. I appreciate your feedback. The questionnaire will remain below for posterity's sake.

To clarify a few things:

  • I did not intend to mean that we should/can use the @ symbol for annotations. I should have been more clear to state that this was about the idea of using annotations to dictate what is a setter, not on the exact details here. What symbol is used for annotations is fairly irrelevant if we don't like the idea of using them as a means to declare getters/setters, don't you think?
  • I'm not sure why everyone likes C# syntax. It seeems that I am a lone man who believes that is a syntactic abomination.

##Greetings, minions of PHP!

@morrisonlevi
morrisonlevi / $$$Money
Last active December 11, 2015 18:18
Click here to make me money.
I wish making money were that easy.
I really do.
@morrisonlevi
morrisonlevi / Class.php
Last active December 14, 2015 13:09 — forked from anonymous/Class.php
<?php
/**
* Note that the static members are shared across two instances for simplicity;
* it certainly could be coded otherwise.
*/
class Hotplate {
public $array = [];
<?php
require __DIR__ . '/../vendor/rdlowrey/Amp/autoload.php';
require __DIR__ . '/setup.php';
use Amp\Reactor,
Amp\ReactorFactory,
Amp\Async\CallResult,
Amp\Async\Dispatcher,
<?php
$stack = new SplStack();
$stack->push(3);
$stack->push(2);
$stack->push(1);
$stack->unshift(4);
foreach ($stack as $value) {
@morrisonlevi
morrisonlevi / sitemap.txt
Created March 29, 2013 15:49
A simplified site-map to use in my routing tests.
/
/account
/account/create
/account/login
/account/group/#
/account/groups
/account/renewal/#
/account/renewals
/account/request/#
/account/requests
@morrisonlevi
morrisonlevi / ReduceImplementations.php
Last active December 15, 2015 15:59
Performance tests of implementing reduce in PHP.
<?php
function add($a, $b) {
return $a + $b;
}
function foldl(array $array, $function, $initial) {
if (empty($array)) {
return $initial;
}