Please, don't use mysql_*
functions to write new code. They are no longer maintained and the community has begun the deprecation process. See the red box? Instead, you should learn about prepared statements and use either PDO or MySQLi. If you can't decide which, this article will help you. If you pick PDO, here is good tutorial.
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
/** | |
* {@inheritdoc} | |
* | |
* @note Image dimensions returned as array(width, height) | |
*/ | |
public function fetchMetaDataFrom($filePath) | |
{ | |
if (!file_exists($filePath)) | |
throw new MetaDataFileNotFoundException(sprintf("File %s could not be found for metadata retrieval", $filePath)); |
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
# available in /etc/nginx/nginx.conf | |
user www-data; | |
worker_processes 4; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 768; | |
} |
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 | |
namespace Seedstream; | |
use React\EventLoop\LoopInterface, | |
React\Socket\ConnectionInterface; | |
class Pusher | |
{ | |
private $loop; |
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 | |
$var = "foo"; | |
list($foo, $bar, $baz) = $var; | |
var_dump($foo, $bar, $baz); | |
list($foo, $bar, $baz) = "foo"; | |
var_dump($foo, $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
Please, don't use `mysql_*` functions for new code. They are no longer maintained and the community has begun the [deprecation process](http://news.php.net/php.internals/53799). See the [**red box**](http://php.net/mysql-connect)? Instead you should learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) and use either [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli). If you can't decide, [this article](http://php.net/mysqlinfo.api.choosing) will help to choose. If you care to learn, [here is good PDO tutorial](http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers). |
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 defined('SYSPATH') or die('No direct script access.'); | |
/** | |
* JSON helper class | |
* | |
* Examples: | |
* $j = JSON::decode('{"Organization": "Kohana"}'); // Good | |
* $j = JSON::decode("{'Organization': 'Kohana'}"); // Invalid | |
* $j = JSON::decode('{"Organization": "Kohana"}', NULL, 1); // depth stack exceeded | |
* | |
* @package Kohana |
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
/* Expanded form of a bookmarklet for extracting rev=canonical OR tinyurling a page */ | |
(function(){ | |
var url=document.location; | |
var links=document.getElementsByTagName('link'); | |
var found=0; | |
for(var i = 0, l; l = links[i]; i++) { | |
if (l.getAttribute('rev') == 'canonical' || (/alternate short/).exec(l.getAttribute('rel'))) { | |
found=l.getAttribute('href'); | |
break; | |
} |