Skip to content

Instantly share code, notes, and snippets.

@robinflyhigh
robinflyhigh / Set Expire Headers using .htaccess
Last active September 29, 2015 07:58
Set Expire Headers using .htaccess
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"
# cache.appcache needs re-requests
# in FF 3.6 (thx Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"
@robinflyhigh
robinflyhigh / Non WWW to WWW using .htaccess
Last active September 29, 2015 06:18
Non WWW to WWW using .htaccess
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
@robinflyhigh
robinflyhigh / Split Long Sentence into Lines
Last active September 29, 2015 05:47
Split Long Sentence into Lines
<?php
/* Split Long Sentence into Lines/*
function getLines($content)
{
$pos = strpos($content, '.');
if($pos === false)
return $content;
else
return substr($content, 0, $pos+1);
}
@robinflyhigh
robinflyhigh / Display Object on Browser
Last active September 29, 2015 05:47
Display Object on Browser
<?php
/*
Display Object on browser for easy reading...
*/
function print_object($obj)
{
echo "<pre>";
print_r($obj);
echo "<pre>";