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
//partial html can simply be inserted into the dom | |
$('.ajax-content').html(data); | |
//json needs to be mapped | |
$('#form_id').val(data['id']); | |
$('#form_firstName').val(data['firstName']); | |
$('#form_lastName').val(data['lastName']); | |
$('#form_phone').val(data['phone']); | |
$('#form_street').val(data['street']); | |
$('#form_city').val(data['city']); |
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 myDispatcher extends Dispatcher | |
{ | |
protected function dispatchController($class, $method, $args, $context = null) | |
{ | |
$obj = new $class($context); | |
return call_user_func(array($obj, $method), array_values($args)); | |
} | |
} |
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 | |
//File: test.php | |
//Create the file SplClassLoader.php and add the contents of this gist https://gist.github.com/221634 | |
//Example: | |
//Class Foo\Bar located in 'src/Foo/Bar.php' | |
require 'SplClassLoader.php'; | |
$autoloader = new SplClassLoader('Foo', 'src'); |
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 | |
require_once __DIR__.'/../app/bootstrap.php.cache'; | |
require_once __DIR__.'/../app/AppKernel.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
$mode = (getenv('APPLICATION_ENV')) ? getenv('APPLICATION_ENV') : 'dev'; | |
umask(0000); |
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
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName {HOST} | |
DocumentRoot /usr/development/{projName}/web | |
<Directory /> | |
Options FollowSymLinks | |
AllowOverride All | |
</Directory> | |
<Directory /usr/development/{ProjName}/web> |
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/sh | |
# | |
# Created by configure | |
'./configure' \ | |
'--with-curl' \ | |
'--with-pdo-mysql=shared' \ | |
'--enable-mbstring' \ | |
"$@" |
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 ObjectId | |
{ | |
public function getObjectId() | |
{ | |
if(!isset($this->__objectId__)) { | |
$this->__objectId__ = uniqid(); | |
} | |
return $this->__objectId__; |
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 | |
//Unfortunately, AutoLoader can't auto load itself | |
require '/path/to/AutoLoader.php'; | |
$auto_loader = new AutoLoader; | |
$auto_loader->registerDirectory('lib1/'); | |
$auto_loader->registerDirectory('lib2/'); | |
$foo = new Foo; | |
$bar = new Bar; |
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 | |
function load_one( $class_name ) | |
{ | |
$file = 'lib1/' . $class_name . '.php'; | |
if( file_exists($file) ) | |
{ | |
require_once $file; | |
} |
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 | |
function __autoload( $class_name ) | |
{ | |
$file = $class_name . '.php'; | |
$dirs = array( 'lib1/', 'lib2/'); | |
foreach( $dirs as $dir ) | |
{ | |
if( file_exists($dir . $file) ) | |
{ |
NewerOlder