A list of amazingly awesome PHP libraries, resources and shiny things.
- Composer/Packagist - A package and dependency manager.
- Composer Installers - A multi framework Composer library installer.
<?php | |
class Process_Manager implements Countable | |
{ | |
protected $processes = array(); | |
protected $is_child = FALSE; | |
public function count() | |
{ | |
return count($this->processes); |
#!/usr/bin/php -q | |
<?php | |
/** | |
* System_Daemon turns PHP-CLI scripts into daemons. | |
* | |
* PHP version 5 | |
* | |
* @category System | |
* @package System_Daemon | |
* @author Kevin <[email protected]> |
<?php | |
Class Purge { | |
static $instance = false; | |
/** | |
* IP address of the current user | |
* | |
* @var string |
A list of amazingly awesome PHP libraries, resources and shiny things.
<?php | |
/** | |
* The __halt_compiler() function will stop the PHP compiler when called. | |
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt. | |
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating. | |
* The template is stored in a temporary file so it can be included and parsed. | |
* | |
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php | |
* http://php.net/manual/en/function.halt-compiler.php | |
*/ |
<VirtualHost *:80> | |
ServerName example.dev | |
DocumentRoot /var/www/vhosts/www.example.com/public | |
# Enable Rewrite Log Debugging (Apache 2.2) | |
RewriteLog /var/www/vhosts/www.example.com/rewrite.log | |
RewriteLogLevel 6 | |
# Enable Rewrite Log Debugging (Apache 2.4) | |
# LogLevel alert rewrite:trace6 |
var socket = io.connect('http://grid.moeinhm.ir:3000'); | |
var GridTask = new Worker('matrix.js'); | |
GridTask.postMessage('doIt'); | |
GridTask.onmessage = function(result){ | |
socket.emit('result',result); | |
GridTask.postMessage('doIt'); | |
}; | |
GridTask.onmessage(result); |
<?php | |
function shutdown_find_exit() | |
{ | |
var_dump($GLOBALS['dbg_stack']); | |
} | |
register_shutdown_function('shutdown_find_exit'); | |
function write_dbg_stack() | |
{ | |
$GLOBALS['dbg_stack'] = debug_backtrace(); |
setlocale(LC_ALL, 'en_US.UTF8'); | |
function toAscii($str, $replace=array(), $delimiter='-') { | |
if( !empty($replace) ) { | |
$str = str_replace((array)$replace, ' ', $str); | |
} | |
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str); | |
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean); | |
$clean = strtolower(trim($clean, '-')); | |
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean); |
window.onbeforeunload = function() { return "Message"; }; |