Skip to content

Instantly share code, notes, and snippets.

@m4rw3r
m4rw3r / gist:917895
Created April 13, 2011 16:51
Router cache file generated by InjectFramework
<?php
/**
* Route cache file generated on 2011-04-13 18:33:34 by Inject Framework Router
* (Inject\Web\Router\Generator).
*/
/*
Routes.php:
$this->root()->to('Test#index');
@m4rw3r
m4rw3r / gist:987491
Created May 23, 2011 20:14
Starcraft2 Tournament helper system specifications

StarCraft 2 Bracket and Map-choosing system

This is just an attempt at a half-serious project, will probably try to make one as a test for my PHP Framework while I'm working on that.

Specifications

@m4rw3r
m4rw3r / gist:1084295
Created July 15, 2011 08:08
Example router
<?php
// Rules:
$this->root()->to('Test#index');
$this->match('archive/:year/:month', array('year' => '\d{4}', 'month' => '1[0-2]|0[1-9]'))
->to('Blog#archive')->name('blog_archive');
// Mount a callback (only string-callbacks are allowed, so no objects or closures yet)
object(Inject\Router\RegExp\Result)#2 (3) {
["delimiter"]=>
string(1) "/"
["modifiers"]=>
array(2) {
["PCRE_CASELESS"]=>
string(1) "i"
["PCRE8"]=>
string(1) "u"
}
object(Inject\Router\RegExp\RegExp)#1 (3) {
["pattern":protected]=>
object(Inject\Router\RegExp\Pattern)#2 (1) {
["parts":protected]=>
array(9) {
[0]=>
string(2) "\/"
[1]=>
string(1) "f"
[2]=>
<?php
function($url)
{
$matches = array();
if(isset($url[0]) && $url[0] == "/")
{
if(isset($url[1]) && $url[1] == "t")
{
<?php
function($url)
{
$matches = array();
if(isset($url[0]) && $url[0] == "/")
{
if(isset($url[1]) && $url[1] == "u")
{
Sampling process 20014 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Chocolat (pid 20014) every 1 millisecond
Process: Chocolat [20014]
Path: /Applications/Chocolat.app/Contents/MacOS/Chocolat
Load Address: 0x100000000
Identifier: com.chocolatapp.Chocolat
Version: ??? (0.0.30)
Code Type: X86-64 (Native)
Parent Process: launchd [640]
@m4rw3r
m4rw3r / gist:1148820
Created August 16, 2011 10:34
Code generated by Inject\Router\CompilingDynamic
<?php
array('GET' => function($url)
{
$matches = array();
if(isset($url[0]) && $url[0] == "/")
{
if(isset($url[1]) && $url[1] == "u" && isset($url[2]) && $url[2] == "s" && isset($url[3]) && $url[3] == "e" && isset($url[4]) && $url[4] == "r")
{
@m4rw3r
m4rw3r / Evenement1.diff
Created August 17, 2011 08:26
Diff to remove the need of sorting the list before calls
diff --git a/src/Evenement/EventEmitter.php b/src/Evenement/EventEmitter.php
index 5b8d00c..8207aaf 100644
--- a/src/Evenement/EventEmitter.php
+++ b/src/Evenement/EventEmitter.php
@@ -29,21 +29,16 @@ namespace Evenement;
class EventEmitter
{
private $listeners = array();
- private $modified = array();