Skip to content

Instantly share code, notes, and snippets.

View gist:e4c22b8ca31dbddd6af0
./buildconf --force
./configure --enable-debug --enable-mbstring --with-gd --with-gmp --with-openssl --with-pdo-mysql --with-config-file-path=/etc --enable-phalcon --with-curl --with-mcrypt
View example.zep
namespace Phalcon\Mvc;
/**
* Phalcon\Mvc\Dispatcher
*
* Dispatching is the process of taking the request object, extracting the module name,
* controller name, action name, and optional parameters contained in it, and then
* instantiating a controller and calling an action of that controller.
*
*<code>
View gist:10328189
; Function Attrs: nounwind ssp uwtable
define i32 @x(%struct._zval_struct* %z) #0 {
%1 = alloca %struct._zval_struct*, align 8
store %struct._zval_struct* %z, %struct._zval_struct** %1, align 8
%2 = load %struct._zval_struct** %1, align 8
%3 = getelementptr inbounds %struct._zval_struct* %2, i32 0, i32 2
%4 = load i8* %3, align 1
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
View index.php
<?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)
View Security.php
<?php
use Phalcon\Events\Event,
Phalcon\Mvc\User\Plugin,
Phalcon\Mvc\Dispatcher,
Phalcon\Acl;
/**
* Security
*
View gist:6782504
<memory-grow>
if some-condition {
<here-we-need-the-memory-grow>
}
<restore-stack>
View mydialect.php
<?php
class MyDialect extends \Phalcon\Db\Dialect\Mysql
{
/**
* Gets the column name in MySQL
*
* @param Phalcon\Db\ColumnInterface $column
* @return string
*/
View gist:6186423
#!/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`
View volt2.php
<?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>
View config.m4
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
You can’t perform that action at this time.