<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - aamirrajpoot</title>
<link>http://snipplr.com/users/aamirrajpoot</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Tue, 21 May 2013 03:04:58 GMT</pubDate>
<item>
<title>(PHP) URLs in Text, and Parsing them into Hyperlinked HTML urls</title>
<link>http://snipplr.com/view/58653/urls-in-text-and-parsing-them-into-hyperlinked-html-urls/</link>
<description><![CDATA[ <p>Try something like this.

$pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i";
$replace = "http://\\1\\2";
$string = [url=http://us2.php.net/preg-replace]preg_replace[/url]($pattern,$replace,$string);
echo $string;

Where $string is the text. Just a couple notes about this pattern:
1) The URI MUST have "http://" before it
2) It works for URIs formatted in the following ways
>>>http://www.example.foo
>>>http://www.example.foo.foo #having two
>>>http://example.foo
>>>http://example.foo.foo #having two
>>>http://foo.exmaple.foo #pretty much the same as above</p> ]]></description>
<pubDate>Wed, 14 Sep 2011 00:20:15 GMT</pubDate>
<guid>http://snipplr.com/view/58653/urls-in-text-and-parsing-them-into-hyperlinked-html-urls/</guid>
</item>
<item>
<title>(MySQL) Find off days in a date range using mysql</title>
<link>http://snipplr.com/view/56577/find-off-days-in-a-date-range-using-mysql/</link>
<description><![CDATA[ <p>A function to get off days inside mySQL</p> ]]></description>
<pubDate>Thu, 14 Jul 2011 01:12:30 GMT</pubDate>
<guid>http://snipplr.com/view/56577/find-off-days-in-a-date-range-using-mysql/</guid>
</item>
<item>
<title>(PHP) Order by rand() Reduce time II</title>
<link>http://snipplr.com/view/52379/order-by-rand-reduce-time-ii/</link>
<description><![CDATA[ <p>Another version for my old Order by Rand function now it includes some PHP</p> ]]></description>
<pubDate>Wed, 20 Apr 2011 23:01:25 GMT</pubDate>
<guid>http://snipplr.com/view/52379/order-by-rand-reduce-time-ii/</guid>
</item>
<item>
<title>(PHP) Delete All Files</title>
<link>http://snipplr.com/view/49020/delete-all-files/</link>
<description><![CDATA[ <p>This isn't my code, but just thought I would share, since it took me so long to find. This is a function to delete a folder, all sub-folders, and files in one clean move.

Just tell it what directory you want deleted, in relation to the page that this function is executed. Then set $empty = true if you want the folder just emptied, but not deleted. If you set $empty = false, or just simply leave it out, the given directory will be deleted, as well.</p> ]]></description>
<pubDate>Tue, 15 Feb 2011 04:31:39 GMT</pubDate>
<guid>http://snipplr.com/view/49020/delete-all-files/</guid>
</item>
<item>
<title>(PHP) Some Date Functions</title>
<link>http://snipplr.com/view/48778/some-date-functions/</link>
<description><![CDATA[ <p>These are some date functions. 

Get Current Week Start Date
Get Current Week End Date
Get Current Month Start
Get Current Month End
Get Current Year Start
Get Current Year End

and these functions can help you getting last week's start date or next month end date. 

To get last week's start date, remove 7 days from current week, and pass that date to get current week start date and it will return last week's start date.</p> ]]></description>
<pubDate>Thu, 10 Feb 2011 21:50:59 GMT</pubDate>
<guid>http://snipplr.com/view/48778/some-date-functions/</guid>
</item>
<item>
<title>(CSS) CSS Gradient Noise</title>
<link>http://snipplr.com/view/47837/css-gradient-noise/</link>
<description><![CDATA[ <p>CSS Gradient Noise</p> ]]></description>
<pubDate>Tue, 25 Jan 2011 17:15:41 GMT</pubDate>
<guid>http://snipplr.com/view/47837/css-gradient-noise/</guid>
</item>
<item>
<title>(PHP) PHP Password Strength Calculation</title>
<link>http://snipplr.com/view/47836/php-password-strength-calculation/</link>
<description><![CDATA[ <p>Copied it for later use hehe</p> ]]></description>
<pubDate>Tue, 25 Jan 2011 17:14:02 GMT</pubDate>
<guid>http://snipplr.com/view/47836/php-password-strength-calculation/</guid>
</item>
<item>
<title>(MySQL) Order By rand() Reduce Time</title>
<link>http://snipplr.com/view/46879/order-by-rand-reduce-time/</link>
<description><![CDATA[ <p>A guy asked me to reduce the query execution time. He is getting 10 results but the query had joins which makes it time consuming.</p> ]]></description>
<pubDate>Mon, 10 Jan 2011 23:25:41 GMT</pubDate>
<guid>http://snipplr.com/view/46879/order-by-rand-reduce-time/</guid>
</item>
<item>
<title>(JavaScript) WYSIWYG Bold effect on a DIV, Span etc.</title>
<link>http://snipplr.com/view/46434/wysiwyg-bold-effect-on-a-div-span-etc/</link>
<description><![CDATA[ <p>Create a div with 'news_bulletin_div' as ID and add css as you like, add Bold button infront of it using float (or what ever where ever)

Add toggleSelectionBold on that button.

Now select a part of text within the DIV and click bold. It will bold it, again select the same bold text and click bold button and it will un-bold the selection.

Cheers.</p> ]]></description>
<pubDate>Mon, 03 Jan 2011 22:44:05 GMT</pubDate>
<guid>http://snipplr.com/view/46434/wysiwyg-bold-effect-on-a-div-span-etc/</guid>
</item>
<item>
<title>(MySQL) Alpha Numeric Sorting in MySQL</title>
<link>http://snipplr.com/view/41275/alpha-numeric-sorting-in-mysql/</link>
<description><![CDATA[ <p>Okay,

If it is required to sort columns like this

1A
1a
10A
9B
21C
1C
1D

And Our desired Result is

1A
1C
1D
1a
9B
10A
21C

We can use casting, but casting will not sort 1A, 1B,1C properly. To overcome this issue we are  first converting this column to binary and sorting the binary combined with tbl_column.


hehe,,, after doing some headbanging just did it with casting too... and using same logic... damn why I didnt thought of that.</p> ]]></description>
<pubDate>Fri, 01 Oct 2010 22:53:53 GMT</pubDate>
<guid>http://snipplr.com/view/41275/alpha-numeric-sorting-in-mysql/</guid>
</item>
<item>
<title>(PHP) WYSIWYG text to Flash Supported</title>
<link>http://snipplr.com/view/41235/wysiwyg-text-to-flash-supported/</link>
<description><![CDATA[ <p>This class is used to convert any WYSIWYG text to flash friendly text.

Hope you people would like that.</p> ]]></description>
<pubDate>Fri, 01 Oct 2010 17:25:16 GMT</pubDate>
<guid>http://snipplr.com/view/41235/wysiwyg-text-to-flash-supported/</guid>
</item>
<item>
<title>(JavaScript) DIV Sorter</title>
<link>http://snipplr.com/view/40735/div-sorter/</link>
<description><![CDATA[ <p>This is a jQuery plugin. It is alternate of Table Sorter, as it will sort the DIV</p> ]]></description>
<pubDate>Sat, 18 Sep 2010 22:41:59 GMT</pubDate>
<guid>http://snipplr.com/view/40735/div-sorter/</guid>
</item>
<item>
<title>(PHP) Get working days between two dates, with custom off day</title>
<link>http://snipplr.com/view/40728/get-working-days-between-two-dates-with-custom-off-day/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 18 Sep 2010 20:38:12 GMT</pubDate>
<guid>http://snipplr.com/view/40728/get-working-days-between-two-dates-with-custom-off-day/</guid>
</item>
</channel>
</rss>