Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
// Prints out a Code 39 barcode in HTML/CSS | |
// $string should be a Code 39-compliant string to encode. | |
// Any characters not in the array below will be discarded. | |
function print_code39_barcode($string) { | |
$code39 = array( | |
'0'=>'NnNwWnWnN', '1'=>'WnNwNnNnW', | |
'2'=>'NnWwNnNnW', '3'=>'WnWwNnNnN', | |
'4'=>'NnNwWnNnW', '5'=>'WnNwWnNnN', | |
'6'=>'NnWwWnNnN', '7'=>'NnNwNnWnW', | |
'8'=>'WnNwNnWnN', '9'=>'NnWwNnWnN', |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
class Foo | |
{ | |
private $_em; | |
public function __construct($entity_manager) | |
{ | |
$this->_em = $entityManager; | |
} |
$ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
$ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl
$ chmod +x ~/bin/powssl
$ powssl
RewriteEngine On | |
# Removes index.php | |
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /index.php/$1 | |
# Depends on your web host and setup, check with your web host specific settings | |
RewriteCond %{ENV:SECURE_REDIRECT} !=on |
<?php | |
class Bcrypt | |
{ | |
private $rounds; | |
public function __construct($rounds = 12) | |
{ | |
if (CRYPT_BLOWFISH != 1) { | |
throw new Exception("bcrypt not supported in this installation. See http://php.net/crypt"); | |
} |
{ | |
"require": { | |
"lncd/oauth2-facebook": "*", | |
"slim/slim": "2.*" | |
}, | |
"minimum-stability": "dev" | |
} |
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
<?php | |
/* | |
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP) | |
Author: _ck_ (with contributions by GK, stasilok) | |
Version: 0.1.7 | |
Free for any kind of use or modification, I am not responsible for anything, please share your improvements | |
* revision history | |
0.1.7 2015-09-01 regex fix for PHP7 phpinfo | |
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter |
# Initial setup | |
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name | |
cd project-name | |
git checkout --orphan master | |
git commit -m "Initial commit" | |
# Pulling changes | |
git fetch framework | |
git merge --squash -m "Upgrade Laravel" framework/develop | |
# Fix merge conflicts if any and commit |