Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Game;
use \Game\Connection\Interfaces\Connection;
use Game\Module\Interfaces\Command;
use InvalidArgumentException;
/**
* Game input handler
<?php
namespace Modules\Help\Command;
use Game\Connection\Interfaces\Connection;
use Game\Helper\Output as OutputHelper;
use Game\Input;
use Game\Module\Entity\Interfaces\Manager as EntityManager;
use Game\Output;
app/
- config/
- config.ini
- Controllers/
- ClaimsController.php
- Library/
- Claims.php
- Models
- Claims
- Entity.php
<?php // app/controllers/IndexController.php
class IndexController extends \Phalcon\Mvc\Controller
{
//Index Controller
public function indexAction()
{}
}
<?php
class MyLib extends \Phalcon\Di\InjectionAware
{
private $filename;
public function __construct(\Phalcon\DiInterface $di)
{
$this->setDI($di);
$this->filename = $this->getDI()->get('config')->daemon->hb_filename;
@rianorie
rianorie / gist:10681bd1558b21d3ec2a
Created November 24, 2014 23:14
Phalcon nginx vhost
server {
listen 80;
server_name demo.dev;
@rianorie
rianorie / gist:2bde62576f0d799370d0
Last active August 29, 2015 14:08
Phalcon example dynamic table model
<?php
class CsvTableLogHandler extends \Phalcon\Mvc\Model
{
public function setTable($table)
{
$this->setSource($table);
}
}
@rianorie
rianorie / gist:f87a6864acc3d85721d6
Created November 3, 2014 23:13
Magento nginx vhost
/etc/nginx/sites-available/example.com.conf
------------------------
server {
listen 80;
server_name example.com;
return 301 http://www.example.com$request_uri;
}
server {
listen 80;
server_name example2.com;
@rianorie
rianorie / gist:7f9bf5c92d2559cf2bff
Created November 3, 2014 16:03
Phalcon PHP getPartial
<?php // file [project]/Library/View.php
namespace YourNamespace\Library;
class extendedView extends \Phalcon\Mvc\View
{
public function getPartial($path, $params = array())
{
ob_start();
$this->partial($path, $params);
return ob_get_clean();
<?php
$data = strtolower(trim($data));
if ( ! strlen($data)) { // ""
$r = '';
} elseif (is_numeric($data) || is_bool($data)) { // "0" "1" 0 1 false true
$r = ((bool)intval($data) ? 'Yes' : 'No');