Skip to content

Instantly share code, notes, and snippets.

View you-think-you-are-special's full-sized avatar
:octocat:
Coding...

Aleksandr Litvinov you-think-you-are-special

:octocat:
Coding...
View GitHub Profile
kill -9 $(lsof -t -i :9000)
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message) {
echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
}
?>
<?php
protected function checkMethodExists($method)
{
if (!method_exists($this, $method))
throw new CException("Method CController::{$method}() not found");
}
?>
@you-think-you-are-special
you-think-you-are-special / DS.php
Created July 17, 2013 07:25
DIRECTORY_SEPARATOR
<?php defined('DS') or define('DS', DIRECTORY_SEPARATOR); ?>
<?php
class RedisSessionHandler implements \SessionHandlerInterface{
public $ttl = 1800; // 30 minutes default
protected $db;
protected $prefix;
public function __construct(Predis\Client $db, $prefix = 'PHPSESSID:') {
<?php
trait GetterSetter
{
public function __get($name)
{
$getter = 'get' . ucfirst($name);
if ( ! method_exists($this, $getter) )
{
throw new \Exception('Not found getter for property - ' . $name);
}