##Given Apache 2 and MySQL are already installed.
#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated
#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules
<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$"> | |
Satisfy Any | |
Order allow,deny | |
Allow from all | |
Deny from none | |
</FilesMatch> |
SetEnvIf User-Agent ^Adobe\sFlash let_me_in | |
<Directory /var/www/vhosts/dev.domain.com> | |
Satisfy Any | |
Order allow,deny | |
Allow from env=let_me_in | |
Deny from none | |
</Directory> |
/** | |
* Get the offset of the given timezone (in seconds) | |
*/ | |
function getTimeZoneOffset($timezone='') { | |
$tz_tmp = new DateTimeZone($timezone); | |
$dt_tmp = new DateTime('now', $tz_tmp); | |
$offset = $dt_tmp->getOffset(); | |
return $offset; | |
} |
/* Friendly timezone abbreviations in client-side JavaScript | |
`tzAbbr()` or `tzAbbr(new Date(79,5,24))` | |
=> "EDT", "CST", "GMT", etc.! | |
There's no 100% reliable way to get friendly timezone names in all | |
browsers using JS alone, but this tiny function scours a | |
stringified date as best it can and returns `null` in the few cases | |
where no friendly timezone name is found (so far, just Opera). |
##Given Apache 2 and MySQL are already installed.
#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated
#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules
function use_root_relative_url($input) { | |
$output = preg_replace_callback( | |
'!(https?://[^/|"]+)([^"]+)?!', | |
create_function( | |
'$matches', | |
// if full URL is site_url, return a slash for relative root | |
'if (isset($matches[0]) && $matches[0] === site_url()) { return "/";' . | |
// if domain is equal to site_url, then make URL relative | |
'} elseif (isset($matches[0]) && strpos($matches[0], site_url()) !== false) { return $matches[2];' . | |
// if domain is not equal to site_url, do not make external link relative |
# Tell system when Xcode utilities live: | |
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
# Set "opendiff" as the default mergetool globally: | |
git config --global merge.tool opendiff |