This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RedisSessionHandler implements \SessionHandlerInterface{ | |
public $ttl = 1800; // 30 minutes default | |
protected $db; | |
protected $prefix; | |
public function __construct(Predis\Client $db, $prefix = 'PHPSESSID:') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('DS') or define('DS', DIRECTORY_SEPARATOR); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function checkMethodExists($method) | |
{ | |
if (!method_exists($this, $method)) | |
throw new CException("Method CController::{$method}() not found"); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach(Yii::app()->user->getFlashes() as $key => $message) { | |
echo '<div class="flash-' . $key . '">' . $message . "</div>\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill -9 $(lsof -t -i :9000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by alexander on 24.02.14. | |
*/ | |
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema; | |
var User = new Schema({ | |
name: String, | |
created: {type: Date, default: Date.now} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Singleton | |
{ | |
protected static $instance; | |
protected function __construct() | |
{ | |
static::setInstance($this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Options { | |
public function setOptions(array $options) | |
{ | |
// apply options | |
foreach ($options as $key => $value) { | |
$method = 'set' . $this->normalizeKey($key); | |
if (method_exists($this, $method)) { | |
$this->$method($value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server{ | |
listen 80; | |
server_name example.com; | |
access_log /home/path_to_site/access.log; | |
error_log /home/path_to_site/error.log; | |
location / { | |
proxy_pass http://0.0.0.0:8002; | |
proxy_set_header Host $host; |
OlderNewer