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
RewriteEngine On | |
# The following rule tells Apache that if the requested filename | |
# exists, simply serve it. | |
RewriteCond %{REQUEST_FILENAME} -s [OR] | |
RewriteCond %{REQUEST_FILENAME} -l [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^.*$ - [NC,L] | |
# The following rewrites all other queries to index.php. The | |
# condition ensures that if you are using Apache aliases to do |
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 | |
// Testing md5 vs. preg_replace_callback() | |
$execPreg = 0; | |
$execMd5 = 0; | |
for ($i=0; $i<100000; $i++) { | |
$name = randomName(10); | |
$start = microtime(true); | |
$result = preg_replace_callback( |
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
// config/autoload/global.php | |
// ... | |
'router' => array( | |
'routes' => array( | |
'oauth' => array( | |
'options' => array( | |
'route' => '/oauth', | |
), | |
), |
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 Zend\Stratigility\MiddlewarePipe; | |
use Zend\Diactoros\Server; | |
require 'vendor/autoload.php'; | |
$app = new MiddlewarePipe(); | |
$server = Server::createServer($app, $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES); | |
// Injected for all the URL |
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 | |
// include the ZF2 library | |
use Zend\Filter\Encrypt; | |
if (!isset($argv[1]) or !isset($argv[2])) { | |
die("Usage: " . basename(__FILE__) . " <file_to_encrypt> <encryption_key>\n"); | |
} | |
if (!file_exists($argv[1])) { | |
die("The file {$argv[1]} specified doesn't exist\n"); |
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
CREATE TABLE post ( | |
id int(11) NOT NULL auto_increment, | |
title varchar(100) NOT NULL, | |
content TEXT NOT NULL, | |
user_id int(11), | |
category_id int(11), | |
publish_date DATETIME, | |
PRIMARY KEY (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
RPC: GET /getalbum | |
Request | |
{ "id" : 1 } | |
OK Response (200): | |
{ | |
"id" : 1, | |
"artist" : { | |
"name" : "Metallica", | |
"history" : "Simply the best heavy metal band ever!", | |
"genre" : "Heavy metal, Hard rock, Speed metal, Thrash metal" |
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
/GET /user | |
OK Response (200): | |
{ | |
"user" : { | |
"name" : "Foo", | |
"email" : "foo@bar.com" | |
} | |
} |
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 | |
$database = ''; | |
$user = ''; | |
$password = ''; | |
$hostname = ''; | |
$port = 446; | |
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;". | |
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;"; |
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 | |
$database = ''; | |
$hostname = ''; | |
$port = ''; | |
$user = ''; | |
$password = ''; | |
return array( | |
'db' => array( |