<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mat Gargano</title>
	<atom:link href="http://matgargano.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://matgargano.com</link>
	<description>php/wordpress/html5/css3/javascript developer</description>
	<lastBuildDate>Mon, 13 May 2013 17:39:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Getting Started with Selenium and PHP</title>
		<link>http://matgargano.com/getting-started-with-selenium-and-php/</link>
		<comments>http://matgargano.com/getting-started-with-selenium-and-php/#comments</comments>
		<pubDate>Mon, 13 May 2013 17:39:14 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Selenium]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=202</guid>
		<description><![CDATA[Note that I am using OS X 10.8.3 so YMMV. Install PHPUnit pear channel-discover pear.symfony.com sudo pear install pear.symfony.com/Yaml sudo pear install --alldeps pear.phpunit.de/PHPUnit Install Selenium extension for PHPUnit sudo pear install phpunit/PHPUnit_Selenium Here’s a test to show you how to use Selenium to go to google with a firefox driver and enter in a ...]]></description>
				<content:encoded><![CDATA[<p>Note that I am using OS X 10.8.3 so YMMV.</p>
<h1 dir="ltr">Install PHPUnit</h1>
<pre>pear channel-discover pear.symfony.com</pre>
<pre dir="ltr">sudo pear install pear.symfony.com/Yaml</pre>
<pre dir="ltr">sudo pear install --alldeps pear.phpunit.de/PHPUnit</pre>
<h1 dir="ltr">Install Selenium extension for PHPUnit</h1>
<pre>sudo pear install phpunit/PHPUnit_Selenium</pre>
<p dir="ltr">Here’s a test to show you how to use Selenium to go to google with a firefox driver and enter in a search query, just as an example</p>
<p>&nbsp;</p>
<pre>&lt;?php
class TestGoogle extends PHPUnit_Extensions_Selenium2TestCase {
	public function setUp(){
		$this-&gt;setHost('localhost');
		$this-&gt;setPort(4444);
		$this-&gt;setBrowser('firefox');
		$this-&gt;setBrowserUrl('http://google.com');
	}

	public function testEnterText(){
		$this-&gt;url("/");
		//if the next line ever causes the test to fail, check that the class name of the input on google.com is still gbqfif
		$text = $this-&gt;byClassName('gbqfif')-&gt;value('Selenium Made Me Do It!!'); 
		//on the next line replace @USERNAME with your username or it probably will fail, you can always remove this line if you do not want a screenshot
		$this-&gt;screenshot('/Users/@USERNAME/screenshot.'.time().'.png'); 
	}

	public function screenshot($filepath) {
	    $filedata = $this-&gt;currentScreenshot();
	    file_put_contents($filepath, $filedata);
	}
}</pre>
<p>It should return something like this:</p>
<p><a href="http://matgargano.com/wp-content/uploads/2013/05/selenium-screenshot.png"><img class="size-full wp-image-204 alignleft" alt="selenium-screenshot" src="http://matgargano.com/wp-content/uploads/2013/05/selenium-screenshot.png" width="566" height="197" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Have fun testing!</p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/getting-started-with-selenium-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>htaccess for angular.js projects so that you don&#8217;t get a 404 on some refreshes!</title>
		<link>http://matgargano.com/htaccess-for-angular-js-projects-so-that-you-dont-get-a-404-on-some-refreshes/</link>
		<comments>http://matgargano.com/htaccess-for-angular-js-projects-so-that-you-dont-get-a-404-on-some-refreshes/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 18:08:32 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[angularjs]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=196</guid>
		<description><![CDATA[Just make this the htaccess &#60;IfModule mod_rewrite.c&#62; RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) /index.php/#/$1 &#60;/IfModule&#62;]]></description>
				<content:encoded><![CDATA[<p>Just make this the htaccess <img src='http://matgargano.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre><code>&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)       /index.php/#/$1 
&lt;/IfModule&gt;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/htaccess-for-angular-js-projects-so-that-you-dont-get-a-404-on-some-refreshes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing git on CentOS 6.4 with cPanel</title>
		<link>http://matgargano.com/installing-git-on-centos-6-4-with-cpanel/</link>
		<comments>http://matgargano.com/installing-git-on-centos-6-4-with-cpanel/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 13:00:10 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=194</guid>
		<description><![CDATA[So, I ran into an issue installing git on a box that had CentOS 6.4 on it&#8230; I kept pulling out my hair&#8230; Turns out&#8230; Per http://serverfault.com/questions/337399/cant-install-git-on-a-centos-6-0-x64 &#8212; to install git on a machine with CentOS 6.4 and cPanel you can install git using: yum install git --disableexcludes=main --skip-broken Have fun out there!]]></description>
				<content:encoded><![CDATA[<p>So, I ran into an issue installing git on a box that had CentOS 6.4 on it&#8230; I kept pulling out my hair&#8230; Turns out&#8230;</p>
<p>Per http://serverfault.com/questions/337399/cant-install-git-on-a-centos-6-0-x64 &#8212; to install git on a machine with CentOS 6.4 and cPanel you can install git using:</p>
<pre>yum install git --disableexcludes=main --skip-broken</pre>
<p>Have fun out there!</p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/installing-git-on-centos-6-4-with-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the Taxonomy and Term from within archive.php</title>
		<link>http://matgargano.com/getting-the-taxonomy-and-term-from-within-archive-php/</link>
		<comments>http://matgargano.com/getting-the-taxonomy-and-term-from-within-archive-php/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 13:30:32 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=186</guid>
		<description><![CDATA[This one just takes advantage of get_query_var, see below: $taxonomy_name = get_taxonomy( get_query_var( 'taxonomy' ) )->labels->name; $term_name = get_term_by( 'slug',$term, get_query_var('taxonomy') )->name;]]></description>
				<content:encoded><![CDATA[<p>This one just takes advantage of <a href="http://codex.wordpress.org/Function_Reference/get_query_var">get_query_var</a>, see below:</p>
<p><code>$taxonomy_name = get_taxonomy( get_query_var( 'taxonomy' ) )->labels->name;<br />
  $term_name = get_term_by( 'slug',$term, get_query_var('taxonomy') )->name;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/getting-the-taxonomy-and-term-from-within-archive-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use archive.php as the search results page</title>
		<link>http://matgargano.com/use-archive-php-as-the-search-results-page/</link>
		<comments>http://matgargano.com/use-archive-php-as-the-search-results-page/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 13:13:47 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[General Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=180</guid>
		<description><![CDATA[This one is easy too&#8230; add_action( 'template_redirect', function(){ if (is_search()) { include("archive.php"); die(); } }); It&#8217;s important to note this uses an anonymous function which requires PHP 5.3+.]]></description>
				<content:encoded><![CDATA[<p>This one is easy too&#8230;<br />
<code>add_action( 'template_redirect', function(){<br />
<span style="padding-left: 30px;">if (is_search()) {<br />
<span style="padding-left: 60px;">include("archive.php");</span><br />
<span style="padding-left: 60px;">die();</span><br />
<span style="padding-left: 30px;">}<br />
});</span></code></p>
<p>It&#8217;s important to note this uses an <a href="http://php.net/manual/en/functions.anonymous.php">anonymous function</a> which requires PHP 5.3+.</p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/use-archive-php-as-the-search-results-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a Unix Timestamp in JavaScript (same as time() in PHP)</title>
		<link>http://matgargano.com/getting-a-unix-timestamp-in-javascript-same-as-time-in-php/</link>
		<comments>http://matgargano.com/getting-a-unix-timestamp-in-javascript-same-as-time-in-php/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 19:06:22 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=176</guid>
		<description><![CDATA[It&#8217;s easy&#8230; var timenow = Math.round((new Date()).getTime() / 1000);]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s easy&#8230;</p>
<p><code>var</code> <code>timenow = Math.round((</code><code>new</code> <code>Date()).getTime() / 1000);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/getting-a-unix-timestamp-in-javascript-same-as-time-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically Include All Class Files in Subdirectory (e.g. inc/ or class/)</title>
		<link>http://matgargano.com/automatically-include-all-class-files-in-subdirectory-e-g-inc-or-class/</link>
		<comments>http://matgargano.com/automatically-include-all-class-files-in-subdirectory-e-g-inc-or-class/#comments</comments>
		<pubDate>Thu, 29 Nov 2012 14:39:47 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[General Development]]></category>
		<category><![CDATA[Plugin Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=165</guid>
		<description><![CDATA[Easy as pie! Here&#8217;s an example to include all PHP files in a subdirectory named class. N.B. Make sure you are one level below the class folder. &#160; foreach (glob(plugin_dir_path(__FILE__) . "class/*.php") as $filename) include $filename;]]></description>
				<content:encoded><![CDATA[<p><strong>Easy as pie!</strong></p>
<p>Here&#8217;s an example to include all PHP files in a subdirectory named <strong>class</strong>.</p>
<p><span style="text-decoration: underline;"><em>N.B. Make sure you are one level below the class folder.</em></span></p>
<p>&nbsp;</p>
<pre>foreach (glob(plugin_dir_path(__FILE__) . "class/*.php") as $filename) include $filename;</pre>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/automatically-include-all-class-files-in-subdirectory-e-g-inc-or-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ignoring Files Locally in Git</title>
		<link>http://matgargano.com/ignoring-files-locally-in-git/</link>
		<comments>http://matgargano.com/ignoring-files-locally-in-git/#comments</comments>
		<pubDate>Wed, 14 Nov 2012 14:41:32 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[General Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=159</guid>
		<description><![CDATA[I wanted to keep some WordPress plugins on my local installation of WordPress that did not end up on my live server: mostly debugging tools (for example: 1, 2 and 3). I could have essentially added them to git ignore, but that would get pushed upstream, so I essentially needed to locally exclude these files/directories. Luckily ...]]></description>
				<content:encoded><![CDATA[<p>I wanted to keep some WordPress plugins on my local installation of WordPress that did not end up on my live server: mostly debugging tools (for example: <a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">1</a>, <a href="http://bueltge.de/debug-objects-wordpress-plugin/966/" target="_blank">2</a> and <a href="http://bueltge.de/wordpress-performance-analysieren-plugin/558/" target="_blank">3</a>). I could have essentially added them to git ignore, but that would get pushed upstream, so I essentially needed to locally exclude these files/directories. Luckily there&#8217;s a fairly painless way to do so on a local machine (this is written from the vantage of a Linux terminal):</p>
<ol>
<li>cd into your .git directory typically resides your base directory (note <a href="http://en.wikipedia.org/wiki/Dot-file">dotfiles</a> may be hidden).</li>
<li>From your .git directory cd into the info directory.</li>
<li>Use the text editor of your choosing to edit the file &#8220;exclude&#8221; in the info directory.</li>
<li>Add the specific paths that you wish to exclude.</li>
<li>Here&#8217;s what my exclude file looks like for the aforelinked plugins to be excluded:</li>
</ol>
<pre># git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
plugins/debug-bar
plugins/debug-objects
plugins/debug-queries</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/ignoring-files-locally-in-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Permenant Alias in OS X Terminal</title>
		<link>http://matgargano.com/permenant-alias-in-os-x-terminal/</link>
		<comments>http://matgargano.com/permenant-alias-in-os-x-terminal/#comments</comments>
		<pubDate>Tue, 13 Nov 2012 14:20:28 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[General Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=156</guid>
		<description><![CDATA[I use MAMP on my local as part of my development environment. When dropping to terminal to perform an action (e.g. git commit/checkout/etc.) I was getting tired of manually changing my directory to the default MAMP root (cd /Applications/MAMP/htdocs/wp-content) so I figured that I&#8217;d add an alias using the following: echo 'alias mamp="cd /Applications/MAMP/htdocs/wp-content"' &#62;&#62; ...]]></description>
				<content:encoded><![CDATA[<p>I use MAMP on my local as part of my development environment. When dropping to terminal to perform an action (e.g. git commit/checkout/etc.) I was getting tired of manually changing my directory to the default MAMP root (cd /Applications/MAMP/htdocs/wp-content) so I figured that I&#8217;d add an alias using the following:</p>
<pre>echo 'alias mamp="cd /Applications/MAMP/htdocs/wp-content"' &gt;&gt; ~/.bashrc &amp;&amp; source ~/.bashrc</pre>
<p>This seemed to work but much to my chagrin the next time I rebooted or opened a new terminal the alias appeared to be gone, bringing me back to step one. I finally figured out how to get this to work permanently &#8230;</p>
<ol>
<li>issue <code>nano ~/.bash_profile</code> to edit your bash profile</li>
<li>add in <code>alias mamp="cd /Applications/MAMP/htdocs/wp-content"</code> and close and save</li>
</ol>
<p>voila!</p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/permenant-alias-in-os-x-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Add a Class to the Body Tag in WordPress</title>
		<link>http://matgargano.com/simple-add-a-class-to-the-body-tag-in-wordpress/</link>
		<comments>http://matgargano.com/simple-add-a-class-to-the-body-tag-in-wordpress/#comments</comments>
		<pubDate>Wed, 11 Jul 2012 13:27:29 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[General Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://matgargano.com/?p=141</guid>
		<description><![CDATA[This is something that is extremely easy once you realize that the hook body_class exists. It is important to pass an variable argument (it can be anything, just has to be there), the hook will pass the current array of classes to that argument. Simple usage of this hook is as follows: function add_body_class ($classes) ...]]></description>
				<content:encoded><![CDATA[<p>This is something that is extremely easy once you realize that the hook <a title="body_class in the WordPress Codex" href="http://codex.wordpress.org/Function_Reference/body_class" target="_blank">body_class</a> exists. It is important to pass an variable argument (it can be anything, just has to be there), the hook will pass the current array of classes to that argument. Simple usage of this hook is as follows:</p>
<pre>function add_body_class ($classes) {
    $classes[] = 'myclass';
    return $classes;
}

add_filter('body_class', 'add_body_class');</pre>
<p>What this does is add the class &#8220;myclass&#8221; to the &lt;body&gt; class.</p>
<p>Here&#8217;s an example of adding a specific class to the homepage, add this to your functions.php (for a theme) or your plugin functions page (for a plugin):</p>
<pre>function add_home_class ($classes) {
   if (is_home()) $classes[] = 'myclass';
    return $classes;
}

add_filter('body_class', 'add_home_class');</pre>
<p>This can be adapted in any way shape or form, just change the logic in the if statement that wraps around the filter.</p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://matgargano.com/simple-add-a-class-to-the-body-tag-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
