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 Category extends Phalcon\Mvc\Model | |
{ | |
public $id; | |
public $lft; | |
public $rgt; |
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 RobotsController extends Phalcon\Mvc\Controller | |
{ | |
public function index() | |
{ | |
echo "Hello Index"; | |
} | |
public function show($id) |
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 | |
$c = new Phalcon\Mvc\View\Engine\Volt\Compiler(); | |
echo htmlentities($c->compileString('{{ a._id }}')); |
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 | |
set_exception_handler(function($e) use ($di) { | |
file_put_contents(APP_PATH . '/app/logs/error-log' . uniqid("", true) . '.txt' , | |
$e->getMessage() . PHP_EOL . | |
print_r($e->getTrace(), true) . PHP_EOL . | |
print_r($_POST, true) . PHP_EOL . | |
print_r($_GET, true) . PHP_EOL . | |
print_r($_SERVER, true) |
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 | |
use Phalcon\Events\Event, | |
Phalcon\Mvc\User\Plugin, | |
Phalcon\Mvc\Dispatcher, | |
Phalcon\Acl; | |
/** | |
* Security | |
* |
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
<memory-grow> | |
if some-condition { | |
<here-we-need-the-memory-grow> | |
} | |
<restore-stack> |
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 MyDialect extends \Phalcon\Db\Dialect\Mysql | |
{ | |
/** | |
* Gets the column name in MySQL | |
* | |
* @param Phalcon\Db\ColumnInterface $column | |
* @return string | |
*/ |
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
#!/bin/bash | |
# Check best compilation flags for GCC | |
export CC="gcc" | |
export CFLAGS="-march=native -mtune=native -O2 -fno-delete-null-pointer-checks -finline-functions -fomit-frame-pointer -fno-builtin-memcmp" | |
echo "int main() {}" > t.c | |
gcc $CFLAGS t.c -o t 2> t.t | |
if [ $? != 0 ]; then | |
chmod +x gcccpuopt | |
BFLAGS=`./gcccpuopt` |
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 | |
$volt = new Phalcon\Mvc\View\Engine\Volt\Compiler(); | |
file_put_contents('x.php', $volt->compileString('{%- macro error_messages(message, field, type) %} | |
<div> | |
<span class="error-type">{{ type }}</span> | |
<span class="error-field">{{ field }}</span> | |
<span class="error-message">{{ message }}</span> | |
</div> |
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_ARG_ENABLE(test, whether to enable test, [ --enable-test Enable test framework]) | |
if test "$PHP_TEST" = "yes"; then | |
AC_DEFINE(HAVE_TEST, 1, [Whether you have Test]) | |
test_sources="test.c kernel/main.c kernel/memory.c kernel/exception.c kernel/hash.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/string.c kernel/fcall.c kernel/alternative/fcall.c kernel/operators.c arithmetic.c flow.c nativearray.c assign.c fibonnaci.c" | |
PHP_NEW_EXTENSION(test, $test_sources, $ext_shared) | |
fi |
NewerOlder