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.
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[0;34m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" | |
WHITE="\[\033[1;37m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" | |
COLOR_NONE="\[\e[0m\]" |
/** | |
* Git Pull | |
* | |
* @author Adam Patterson | |
* http://www.adampatterson.ca/blog/2011/10/diy-simple-staging-server/ | |
* | |
* Use: echo pull(); | |
*/ | |
function pull ( ) |
<?php | |
/** | |
* Here is a non-magic-method version for those that need better auto-complete and faster access times. | |
* It also filters the input to be valid UTF-8 just when needed thanks to phunction. | |
*/ | |
class input | |
{ | |
public static $encoding = 'UTF-8'; | |
public static function server($key, $default = NULL, $control = true) |
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.
#!/bin/bash | |
########## | |
## Setup: hardcode your mysql user/pass. Yeah, yeah, I know...it's frowned upon. | |
## but for local development, I have no problem with it. | |
## Find and replace: MYSQLUSER / MYSQLPASS | |
## | |
## Usage: This script accepts only one variable, the site name. | |
## | |
######### |
<?php | |
class DocBlock { | |
public $docblock, | |
$description = null, | |
$all_params = array(); | |
/** | |
* Parses a docblock; |
<?php | |
/** | |
* Ranking Library | |
* contains alogrithms for story ranking | |
* Basically a PHP Implementation of reddits algorithms | |
* | |
* @author Lucas Nolte <lnolte@i.biz> | |
* @since 0.1 | |
* @package Polska Wiadomosc | |
* @subpackage Libraries |
When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.
Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008
…………………………
<?php | |
$date = new DateTime('now'); | |
echo $date->format('d/m/Y').PHP_EOL; // format: day/month/year | |
echo $date->format('m-d-Y').PHP_EOL; // format: month-day-year | |
echo $date->format('Y-m-d').PHP_EOL; // format: year-month-day | |
// add 3 days to current date and output using format year-day-month | |
echo $date->setTimestamp( strtotime('+3 days', $date->getTimestamp()) )->format('Y-d-m'); |
(function() { | |
var CSSCriticalPath = function(w, d, opts) { | |
var opt = opts || {}; | |
var css = {}; | |
var pushCSS = function(r) { | |
if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
for(var i = 0; i < styles.length; i++) { | |
if(!!styles[i] === false) continue; | |
var pair = styles[i].split(": "); |