Skip to content

Instantly share code, notes, and snippets.

Avatar

Timo Reitz GodsBoss

View GitHub Profile
@GodsBoss
GodsBoss / yiiDetachAllEventHandlers.php
Last active Aug 29, 2015
Yii: Detaching all event handlers
View yiiDetachAllEventHandlers.php
<?php
class FooHandling extends CComponent
{
public function onFoo($event) {}
}
function handlerOne($event){}
function handlerTwo($event){}
View MissingNumberFinder.coffee
missingNumber = ((v)->
(n)->
v[n] ?0)
2:10
3:15
4:22
5:31
6:42
8:666
@GodsBoss
GodsBoss / gist:1180970
Created Aug 30, 2011
A PHP FizzBuzz variant.
View gist:1180970
<?php
// For the original version, see
// http://forum.golem.de/read.php?54793,2785037,2785926#msg-2785926
$a = array(0,
'fizz',
'buzz',
'fizzbuzz' ) ;
@GodsBoss
GodsBoss / gist:999405
Created May 30, 2011
Constructor signature
View gist:999405
<?php
interface Something{}
interface AnotherThing{}
class Foo{
public function __construct(Something $thing){}
public function foo(Something $thing){}}
// No problem.
@GodsBoss
GodsBoss / gist:960745
Created May 7, 2011
Access to protected base class members of a subclass via another subclass.
View gist:960745
<?php
class Base{
protected $x;
public function getX(){
return $this->x;}}
/**
* This class tries to ensure that $x is always an integer.
@GodsBoss
GodsBoss / gist:923547
Created Apr 16, 2011
Verschiedene Implementierungen einer Client-Klasse mit einer optionalen Abhängigkeit.
View gist:923547
<?php
/**
* Something the Client may depend on or not.
*/
interface Dependency{
public function action();}
/**
* The Client.