Skip to content

Instantly share code, notes, and snippets.

View zachbrowne's full-sized avatar

Zach Browne zachbrowne

View GitHub Profile
@zachbrowne
zachbrowne / Install Liferay on Ubuntu 10.04
Created October 19, 2011 21:28
Liferay installation on Ubuntu 10.04 LTS
Setting up Liferay on Ubuntu 10.04
# Add java repository & install java
add-apt-repository "deb http://archive.canonical.com/ lucid partner"
apt-get update
apt-get install sun-java6-jdk
apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
# Tell ubuntu to use java
update-java-alternatives -s java-6-sun
@zachbrowne
zachbrowne / WordPress Category Widget Drop Down Widen CSS Code
Created October 22, 2011 15:54
This code will widen the category widget drop-down in the WordPress sidebar (or any widget).
#cat { width: 100%; }
@zachbrowne
zachbrowne / WordPress SEO .htaccess
Created October 23, 2011 19:37
Very good .htaccess file for WordPress SEO
User-agent: *
Disallow: */trackback*
Disallow: /wp-*
Disallow: */feed*
Disallow: /20*
User-Agent: MediaPartners-Google
Allow: /
@zachbrowne
zachbrowne / APC Memcache on Ubuntu
Created October 23, 2011 21:10
Setting up APC and Memcache on Ubuntu
apt-get install php-apc
/etc/init.d/apache2 restart
php -r ‘phpinfo();’ | grep ‘apc’ # See if output shows apc is on
apt-get install php5-memcache
nano /etc/php5/apache2/php.ini
# Change session.save_handler = files to
session.save_handler = memcache
session.save_path = “tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15″
/etc/init.d/apache2 restart
@zachbrowne
zachbrowne / FindLinks.php
Created October 31, 2011 06:35
Find Out All Links In any Website using PHP
@zachbrowne
zachbrowne / FindDomains.php
Created October 31, 2011 06:36
Find Domains on same IP with PHP
<?php
function reverseIP($IP)
{
for($f=0; $f <= 2; $f++)
{
// this will list the results in the first two page...alter the code to get results from more number of pages
$url='<a class="linkclass" href="http://www.bing.com/search?q=ip%3A">http://www.bing.com/search?q=ip%3A</a>'.$IP.'&amp;first='.$f.'1&amp;FORM=PORE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@zachbrowne
zachbrowne / GetMeta.php
Created October 31, 2011 06:38
Get Title and Meta Keywords from any site with PHP
<?php
function getUrlData($url)
{
$result = false;
$contents = getUrlContents($url);
if (isset($contents) && is_string($contents))
{
$title = null;
@zachbrowne
zachbrowne / sendemail.php
Created October 31, 2011 06:47
Send HTML Email with PHP
<?php
define("EmailNewLine", "\r\n");
define("EmailXMailer", "PHP-EMAIL, Samplephpcodes.com");
//** the default charset values for both text and HTML emails.
define("DefaultCharset", "iso-8859-1");
function htmlmail($to, $subject,$content,$cc,$bcc)
@zachbrowne
zachbrowne / verifyemail.php
Created October 31, 2011 06:48
Verify email with PHP
<?php
function VerifyEmail($email){
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
}
if(VerifyEmail('<a class="linkclass" href="mailto:info@samplephpcodes.com">info@samplephpcodes.com</a>')) {
echo 'valid email';
} else {
echo 'in valid email';
}
@zachbrowne
zachbrowne / generatefeed.php
Created October 31, 2011 06:49
Generate RSS feed with PHP
<?php
$XMLoutput = "<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>PHP RSS XML FEED</title>
<link><a class="linkclass" href="http://www.exampledomain.com/RSS-XML-FEED.php">http://www.exampledomain.com/RSS-XML-FEED.php</a></link>
<description>RSS Feed Description</description>
<language>en-us</language>
<pubDate>dd/mm/yy</pubDate>
<lastBuildDate>dd/mm/yy</lastBuildDate>