Skip to content

Instantly share code, notes, and snippets.

MODX

  • originally text template (phpBB2)
  • XML based format
  • machine readable
  • xsd schema validation
  • xsl stylesheet
  • pain to write by hand
  • convertor text => modx
  • modx2?

Explaining hooks

Most of you have probably already seen the blog post regarding the RFC process for hooks to be added to ascraeus (phpBB 3.1). And many of you may not know what a hooks system actually is, so I will take the time to explain it.

In olympus (phpBB 3.0) all new additions to the core must be done by editing or patching the core files. The MODification is either installed manually or by using AutoMOD. What a MOD usually does is add some specific code at a specific location, for example database queries, template assignments or loading of language files. This approach worked for 2.0 and it works for 3.0, but frankly it produces a horrible mess. Installing MODifications is a great pain, uninstalling them is almost impossible in some cases.

To solve this issue we are introducing a hooks system. The hook system defines code injection points, giving each one of them a unique identifier. The hooks manager allows MODificati

Sinatra

ruby 1.9.2 + async_sinatra + thin thin start

ab -n 10000 -c 100 http://localhost:3000/
-> 49ms / request

Node

node server.js
@lox
lox / phark_proposal.md
Created November 23, 2010 04:03
A proposal for a sane php package manager

Proposal for Phark, a sane php package manager

As it stands PEAR sucks. It's complicated, clumsy and is full of utter garbage (sorry).

PHP is rapidly dying because we don't have any decent way of writing code that can easily build on the work of others. What we need is a simple, open package management system like rubygems.

We now have decent support for namespaces, class autoloading and archives. I propose we abandon

<?php
require_once __DIR__.'/silex.phar';
require_once __DIR__.'/twig/lib/Twig/Autoloader.php';
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Silex\Framework;
Twig_Autoloader::register();
<?php
/*
* This file is part of the Assetic package.
*
* (c) Kris Wallsmith <kris.wallsmith@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@p
p / gist:865826
Created March 11, 2011 12:20
Flush poc
<?php
header('Content-Length: 6');
echo('before');
flush();
sleep(4);
echo('after');
@beberlei
beberlei / form_definitions.php
Created March 17, 2011 12:30
This Symfony Form Experimental Branch example does not use the DIC.
<?php
class MyFormType extends AbstractFormType
{
public function configure(FormBuilder $builder, array $options)
{
$builder->setDataClass("MyProject\FooEntity");
$builder->add('my.sub_form');
$builder->add('text', 'name', array('max_length' => 127, 'id' => 'foo'));
$builder->add('date', 'created');
@skremiec
skremiec / index.php
Created April 12, 2011 17:42
Silex problem
This code works perfectly on two different servers (running PHP 5.3.2 and PHP 5.3.3).
Unfortunately it fails on the third one (PHP 5.3.4).
On very first request, just after downloading silex.phar, it produces:
Fatal error: Class 'Silex\Application' not found in /home/users/abc/public_html/index.php on line 7
And any following request ends with:
Fatal error: Uncaught exception 'PharException' with message '__HALT_COMPILER(); must be declared in a phar' in /home/users/abc/public_html/silex.phar:8
@weaverryan
weaverryan / Makefile
Created May 5, 2011 11:36
Example sphinx configuration for rendering the symfony docs
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build -c .
PAPER =
BUILDDIR = build
SOURCE = source