This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
// Reset Font Size | |
var originalFontSize = $('html').css('font-size'); | |
$(".resetFont").click(function(){ | |
$('html').css('font-size', originalFontSize); | |
}); | |
// Increase Font Size | |
$(".increaseFont").click(function(){ | |
var currentFontSize = $('html').css('font-size'); | |
var currentFontSizeNum = parseFloat(currentFontSize, 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$(document).bind("contextmenu",function(e){ | |
return false; | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function highlight($sString, $aWords) { | |
if (!is_array ($aWords) || empty ($aWords) || !is_string ($sString)) { | |
return false; | |
} | |
$sWords = implode ('|', $aWords); | |
return preg_replace ('@\b('.$sWords.')\b@si', '<strong style="background-color:yellow">$1</strong>', $sString); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function generatePassword($length=9, $strength=0) { | |
$vowels = 'aeuy'; | |
$consonants = 'bdghjmnpqrstvz'; | |
if ($strength >= 1) { | |
$consonants .= 'BDGHJLMNPQRSTVWXZ'; | |
} | |
if ($strength >= 2) { | |
$vowels .= "AEUY"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getTinyUrl($url) { | |
return file_get_contents("http://tinyurl.com/api-create.php?url=".$url); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function age($date){ | |
$year_diff = ''; | |
$time = strtotime($date); | |
if(FALSE === $time){ | |
return ''; | |
} | |
$date = date('Y-m-d', $time); | |
list($year,$month,$day) = explode("-",$date); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Create a variable for start time | |
$time_start = microtime(true); | |
// Place your PHP/HTML/JavaScript/CSS/Etc. Here | |
//Create a variable for end time | |
$time_end = microtime(true); | |
//Subtract the two times to get seconds | |
$time = $time_end - $time_start; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function maintenance($mode = FALSE){ | |
if($mode){ | |
if(basename($_SERVER['SCRIPT_FILENAME']) != 'maintenance.php'){ | |
header("Location: http://example.com/maintenance.php"); | |
exit; | |
} | |
}else{ | |
if(basename($_SERVER['SCRIPT_FILENAME']) == 'maintenance.php'){ | |
header("Location: http://example.com/"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="/stylesheet.css?<?php echo time(); ?>" rel="stylesheet" type="text/css" /&glt; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function make_ranked($rank) { | |
$last = substr( $rank, -1 ); | |
$seclast = substr( $rank, -2, -1 ); | |
if( $last > 3 || $last == 0 ) $ext = 'th'; | |
else if( $last == 3 ) $ext = 'rd'; | |
else if( $last == 2 ) $ext = 'nd'; | |
else $ext = 'st'; | |
if( $last == 1 && $seclast == 1) $ext = 'th'; |