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
<div id="object" class="empty"></div> | |
<script type="text/javascript" src="http://js.fullondesign.co.uk/jquery-1.3.2.min.js"></script> | |
<script type="text/javascript"> | |
//<![CDATA[ | |
$("#object").removeClass('empty'); | |
$("#object").addClass('full'); | |
//]]> | |
</script> |
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 | |
// String Cleaner – Cleans words you don't want out of strings. | |
// Step 1 – Define the string and the words yoiu want to remove. | |
$string = 'this is my silly input how cool is it?'; | |
$words_to_remove ='silly|my|eggs'; // Seperate words with | this is regular expression. | |
// Step 2 – shorten the string | |
$string = substr($string, 0, 23); // This with return the first 23 characters (including spaces) in the string. |
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 | |
/* | |
errors class – Helps management of errors in a script. | |
@version | |
1.0 | |
@author | |
Mike Rogers (FullOnDesin.co.uk) | |
@last updated | |
03 June 2009 |
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
<meta http-equiv="X-UA-Compatible" content="chrome=1"> |
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 | |
echo realpath('../'); | |
// Would return: /home/mike/www/blogposts | |
?> |
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 shorten_url($url, $service=NULL){ | |
if($service== 'tinyurl'){return get_link('http://tinyurl.com/api-create.php?url='.urlencode($url));} | |
elseif($service == 'urly'){return get_link('http://ur.ly/new.txt?href='.urlencode($url));} | |
elseif($service == 'isgd'){return get_link('http://is.gd/api.php?longurl='.urlencode($url));} | |
elseif($service == 'klam'){return get_link('http://kl.am/api/shorten/?format=text&url='.urlencode($url));} | |
elseif($service == 'unu'){return get_link('http://u.nu/unu-api-simple?url='.urlencode($url));} | |
else{return get_link('http://api.tr.im/v1/trim_simple?url='.urlencode($url));} | |
return $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 | |
// Filter an Email Address | |
var_dump(filter_var('[email protected]', FILTER_VALIDATE_EMAIL)); // Returns: string(17) "[email protected]" | |
// This is a fake email being filtered. | |
var_dump(filter_var('fake_mail.com', FILTER_VALIDATE_EMAIL)); // Returns: bool(false) | |
var_dump(filter_var('ema(i)[email protected]', FILTER_SANITIZE_EMAIL )); // Returns: string(17) "[email protected]" | |
// Filter a 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 | |
$salt = '%$£Salt_Here*(&^'; | |
$password = md5('password'.$salt); | |
// $password will now return 5747563a265df7a3250884394c0a05e0 | |
?> |
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 # File created on 1st April 2009 by Mike Rogers (http://www.fullondesign.co.uk/). | |
/* | |
function – recent_tweets(string $username [, int $limit = 5]) | |
$username – Your twitter username, such as rogem002 | |
$limit – Default: 5 – how many tweets you wish to show, must be numeric. | |
*/ | |
function recent_tweets($username, $limit=5){ | |
if(!is_numeric($limit)){$limit = 5;} | |
$xml = simplexml_load_file('http://search.twitter.com/search.atom?q=from%3A'.urlencode($username)); |
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 # File created on 3rd April 2009 by Mike Rogers (http://www.fullondesign.co.uk/). | |
/* | |
function – recent_stumbles(string $username [, string $type= NULL [, int $limit = 5]]) | |
$username – The stumbleupon username, such as rogem002 | |
$type – Default: NULL – What you want to limit your rss to show. Can be NULL, blog, comments, favorites or reviews | |
$limit – Default: 5 – how many tweets you wish to show, must be numeric. | |
*/ | |
function recent_stumbles($username, $type=NULL, $limit=5){ | |
if(!is_numeric($limit)){$limit = 5;} | |
if($type !== NULL && $type !== 'blog' && $type !== 'comments' && $type !== 'favorites' && $type !== 'reviews'){$type = NULL;} |