<?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>Monsterbox Productions</title>
	<atom:link href="http://monsterboxpro.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://monsterboxpro.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 04 May 2010 09:35:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Tired out typing out the locals hash in render statements?</title>
		<link>http://monsterboxpro.com/blog/2010/05/04/tired-out-typing-out-the-locals-hash-in-render-statements/</link>
		<comments>http://monsterboxpro.com/blog/2010/05/04/tired-out-typing-out-the-locals-hash-in-render-statements/#comments</comments>
		<pubDate>Tue, 04 May 2010 09:35:45 +0000</pubDate>
		<dc:creator>Tye Shavik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=137</guid>
		<description><![CDATA[We use helpers to refactor our render statements and we end up with a lot of helpers like this: def comment_fields&#40;f,course,discussion,comment&#41; render :partial =&#62; 'comments/fields', :locals =&#62; &#123; :f =&#62; f, :course =&#62; course, :discussion =&#62; discussion, :comment =&#62; comment &#125; end In these helpers you&#8217;re typing out each variable name 3 times, once in [...]]]></description>
			<content:encoded><![CDATA[<p>We use helpers to refactor our render statements and we end up with a lot of helpers like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> comment_fields<span style="color:#006600; font-weight:bold;">&#40;</span>f,course,discussion,comment<span style="color:#006600; font-weight:bold;">&#41;</span>
  render <span style="color:#ff3333; font-weight:bold;">:partial</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'comments/fields'</span>,
    <span style="color:#ff3333; font-weight:bold;">:locals</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> 
      <span style="color:#ff3333; font-weight:bold;">:f</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> f,
      <span style="color:#ff3333; font-weight:bold;">:course</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> course,
      <span style="color:#ff3333; font-weight:bold;">:discussion</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> discussion,
      <span style="color:#ff3333; font-weight:bold;">:comment</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> comment <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In these helpers you&#8217;re typing out each variable name 3 times, once in the function definition and twice in the locals hash. Wouldn&#8217;t it be great if you only had to type the name of the variables in the definition and have the local hash generated automatically? Well we&#8217;ve created a nifty helper called <tt>locals</tt> that will do just that. It works like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> comment_fields<span style="color:#006600; font-weight:bold;">&#40;</span>f,course,discussion,comment<span style="color:#006600; font-weight:bold;">&#41;</span>
  render <span style="color:#ff3333; font-weight:bold;">:partial</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'comments/fields'</span>,
    <span style="color:#ff3333; font-weight:bold;">:locals</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> locals<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">binding</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The <a href="http://ruby-doc.org/core/classes/Kernel.html#M005946"><tt>binding</tt></a> object is built-in to Ruby and allows you to access a list of variable names in the local scope. The <tt>locals</tt> helper will use this object to generate a hash of variables that you can pass to the <tt>render</tt> function.</p>
<p>You will need to put this function in your application_helper.rb:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> locals<span style="color:#006600; font-weight:bold;">&#40;</span>helper_binding,<span style="color:#006600; font-weight:bold;">*</span>locals<span style="color:#006600; font-weight:bold;">&#41;</span>
  options = locals.<span style="color:#9900CC;">extract_options</span>!
  result = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
  vars = <span style="color:#CC0066; font-weight:bold;">eval</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;local_variables&quot;</span>,helper_binding<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">for</span> var <span style="color:#9966CC; font-weight:bold;">in</span> vars
    result<span style="color:#006600; font-weight:bold;">&#91;</span>var.<span style="color:#9900CC;">to_sym</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC0066; font-weight:bold;">eval</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{var}&quot;</span>,helper_binding<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  result.<span style="color:#9900CC;">merge</span><span style="color:#006600; font-weight:bold;">&#40;</span>options<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p><tt>locals(binding)</tt> will grab all the local variables that exist at the time it&#8217;s evaluated (not just the variables that are in the function definition). You can pass a hash to <tt>locals</tt> to specify additional variables to pass. </p>
<p>So for example this code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> comment_fields<span style="color:#006600; font-weight:bold;">&#40;</span>f,course,discussion,comment<span style="color:#006600; font-weight:bold;">&#41;</span>
  user = comment.<span style="color:#9900CC;">user</span>
  render <span style="color:#ff3333; font-weight:bold;">:partial</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'comments/fields'</span>,
    <span style="color:#ff3333; font-weight:bold;">:locals</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> locals<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">binding</span>,
      <span style="color:#ff3333; font-weight:bold;">:comment_count</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> discussion.<span style="color:#9900CC;">comments</span>.<span style="color:#9900CC;">length</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Is the same as:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> comment_fields<span style="color:#006600; font-weight:bold;">&#40;</span>f,course,discussion,comment<span style="color:#006600; font-weight:bold;">&#41;</span>
  render <span style="color:#ff3333; font-weight:bold;">:partial</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'comments/fields'</span>,
    <span style="color:#ff3333; font-weight:bold;">:locals</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> 
      <span style="color:#ff3333; font-weight:bold;">:user</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> comment.<span style="color:#9900CC;">user</span>,
      <span style="color:#ff3333; font-weight:bold;">:f</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> f,
      <span style="color:#ff3333; font-weight:bold;">:course</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> course,
      <span style="color:#ff3333; font-weight:bold;">:discussion</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> discussion,
      <span style="color:#ff3333; font-weight:bold;">:comment</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> comment,
      <span style="color:#ff3333; font-weight:bold;">:comment_count</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> discussion.<span style="color:#9900CC;">comments</span>.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2010/05/04/tired-out-typing-out-the-locals-hash-in-render-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ternary operator bundle command for TextMate</title>
		<link>http://monsterboxpro.com/blog/2010/05/02/ternary-operator-bundle-command-for-textmate/</link>
		<comments>http://monsterboxpro.com/blog/2010/05/02/ternary-operator-bundle-command-for-textmate/#comments</comments>
		<pubDate>Sun, 02 May 2010 14:39:36 +0000</pubDate>
		<dc:creator>Tye Shavik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=121</guid>
		<description><![CDATA[While writing code I often find I change simple if/else statements into single line statements using the ternary (?:) operator. For example this function from Markadee: def mine?&#40;user&#41; if current_user == user t&#40;'users.show.your'&#41; else &#34;#{user.name}'s&#34; end end The if/else takes up 5 lines but the statements are short enough to be put on one line: [...]]]></description>
			<content:encoded><![CDATA[<p>While writing code I often find I change simple if/else statements into single line statements using the ternary (?:) operator. For example this function from Markadee:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> mine?<span style="color:#006600; font-weight:bold;">&#40;</span>user<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> current_user == user
      t<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'users.show.your'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">else</span>
      <span style="color:#996600;">&quot;#{user.name}'s&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The if/else takes up 5 lines but the statements are short enough to be put on one line:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> mine?<span style="color:#006600; font-weight:bold;">&#40;</span>user<span style="color:#006600; font-weight:bold;">&#41;</span>
    current_user == user ? t<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'users.show.your'</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#996600;">&quot;#{user.name}'s&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Usually I will write out the entire if/else statement then change it to single line form afterwards once I see how short it is. To save myself some time I created two Textmate bundle commands to help do this. The first will take a 5 line if/else (such as the one in the mine? function above) and turn it into a single line statement. This requires you select the entire if/else then press the hotkey ⌥⌘T. </p>
<p> The second will do the reverse operation, turning a ternary operator statement into an if/else. The hotkey for the reverse function is ⌃⌥⌘T and will grab the entire current line so you don&#8217;t need to select the statement first.</p>
<p><a href='http://monsterboxpro.com/blog/wp-content/uploads/2010/05/make_ternary_textmate_commands.zip'>Download the Textmate Bundle commands here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2010/05/02/ternary-operator-bundle-command-for-textmate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regular expressions sub/gsub for JQuery</title>
		<link>http://monsterboxpro.com/blog/2010/03/09/regular-expressions-subgsub-for-jquery/</link>
		<comments>http://monsterboxpro.com/blog/2010/03/09/regular-expressions-subgsub-for-jquery/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 06:34:06 +0000</pubDate>
		<dc:creator>Andrew Brown</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gsub]]></category>
		<category><![CDATA[javascript. sub]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[strings]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=104</guid>
		<description><![CDATA[I spent 1.5 hours searching the Internet and the JQuery docs to figure out how to perform sub or gsub on a string with a regular expression. I had to use a crazy mix of keywords to find the answer. Hopefully this blog post gets index on Google so the next person looking to do [...]]]></description>
			<content:encoded><![CDATA[<p>I spent 1.5 hours searching the Internet and the JQuery docs to figure out how to perform sub or gsub on a string with a regular expression. I had to use a crazy mix of keywords to find the answer. Hopefully this blog post gets index on Google so the next person looking to do regular expressions in JQuery doesn&#8217;t have to waste so much time looking for the sub or gsub equivalent because the JQuery people can&#8217;t stick to programming conventions that makes sense and are already known by most programmers. This is a case of unnecessary naming cleverness. Give me back my time JQuery, you time vampire.</p>
<p>Oh, let us not forget the solution:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">&quot;This is a test&quot;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/test/</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'an explosion'</span><span style="color: #009900;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2010/03/09/regular-expressions-subgsub-for-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to get hired as a web-developer</title>
		<link>http://monsterboxpro.com/blog/2010/03/05/how-to-get-hired-as-a-web-developer/</link>
		<comments>http://monsterboxpro.com/blog/2010/03/05/how-to-get-hired-as-a-web-developer/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 05:52:57 +0000</pubDate>
		<dc:creator>Andrew Brown</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hiring]]></category>
		<category><![CDATA[programming resume]]></category>
		<category><![CDATA[web-developer]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=80</guid>
		<description><![CDATA[I&#8217;ve spent hours in the past crafting my resume, portfolio and website but everytime I&#8217;ve been hired, the didn&#8217;t look at my resume, they never saw my portfolio, and they didn&#8217;t even visit my website. I had always offered sample work for free out of selflessness and not expecting anything from it, and they all [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent hours in the past crafting my resume, portfolio and website but everytime I&#8217;ve been hired, the didn&#8217;t look at my resume, they never saw my portfolio, and they <strong>didn&#8217;t even visit my website</strong>. I had always offered sample work for free out of selflessness and not expecting anything from it, and they all turned around offering long lasting work.</p>
<p>You want to get hired as web-developer? Don&#8217;t show a paper that suggest results, give them something to chew, if it tastes good, they&#8217;ll want more.</p>
]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2010/03/05/how-to-get-hired-as-a-web-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to focus on your web-startup</title>
		<link>http://monsterboxpro.com/blog/2010/03/02/how-to-focus-on-your-web-startup/</link>
		<comments>http://monsterboxpro.com/blog/2010/03/02/how-to-focus-on-your-web-startup/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 06:50:58 +0000</pubDate>
		<dc:creator>Andrew Brown</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[robot mind]]></category>
		<category><![CDATA[vistual clutter]]></category>
		<category><![CDATA[web-startup]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=83</guid>
		<description><![CDATA[Look around on your desk and pickup the closest thing near you. I picked up my Swingline red stapler. Why did I buy it?, how often do I use it and why do I need it? I am never stapling and I&#8217;m not going to staple anything in the next year. I have a pile [...]]]></description>
			<content:encoded><![CDATA[<p>Look around on your desk and pickup the closest thing near you.</p>
<p><img src="http://monsterboxpro.com/blog/wp-content/uploads/2010/03/stapler.jpg" alt="" width="600" /></p>
<p>I picked up my Swingline red stapler. Why did I buy it?, how often do I use it and why do I need it? I am never stapling and I&#8217;m not going to staple anything in the next year.</p>
<p>I have a pile of papers on my desk that I&#8217;m holding onto because I need to do my taxes. The pile looks daunting, but if I were to throw out the junk in that pile, doing my taxes would seem much easier.</p>
<p>I need to frequently travel, and I have a pile of clothes. I don&#8217;t wear half of them but when it comes to packing, the pile looks daunting, if I were to throw out the clothes I don&#8217;t wear my packing would seem much easier.</p>
<p>I have a iMac that only gets used to play my itunes music, a Nikon D80 I take photos with but I don&#8217;t take the photos off the camera until three months later.</p>
<p>I don&#8217;t need these things but Its hard to part with them. I know I can justify keeping them because myself as an irrational human being wants to keep them, but I want you to listen to your robot mind.</p>
<div style="background: rgb(245,245,250); padding: 10px;">
<strong style="text-transform: uppercase; font-weight: bold; color: rgb(0,0,0); font-size: 14px;">Stop holding on to shit you don&#8217;t need and remove the visual clutter that is blocking your end goal.<br />
</strong>
</div>
<p>I&#8217;m getting rid of my red stapler today and I want you to question what you picked up, and if you can come up with one reason to justify on how its distracting you from your end goal then throw it out now.</p>
<p>Your end goal awaits you.</p>
]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2010/03/02/how-to-focus-on-your-web-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to properly commit to your git repository (rebasing)</title>
		<link>http://monsterboxpro.com/blog/2010/02/22/how-to-properly-commit-to-your-git-repository-rebasing/</link>
		<comments>http://monsterboxpro.com/blog/2010/02/22/how-to-properly-commit-to-your-git-repository-rebasing/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 07:36:34 +0000</pubDate>
		<dc:creator>Andrew Brown</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[clean]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[proper]]></category>
		<category><![CDATA[rebase]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=60</guid>
		<description><![CDATA[To be a professional Ruby on Rails developer you need to properly commit your changes to the git repos without making a big mess. Compare the two git trees below. The problem is when your working with multiple people on a git repos you can&#8217;t work in master otherwise when you pull changes, you&#8217;ll have [...]]]></description>
			<content:encoded><![CDATA[<p>To be a professional Ruby on Rails developer you need to properly commit your changes to the git repos without making a big mess. Compare the two git trees below.</p>
<p><img src="http://monsterboxpro.com/blog/wp-content/uploads/2010/02/compare_commits1.png" alt="Comparing messy commits with clean commits" /></p>
<p>The problem is when your working with multiple people on a git repos you can&#8217;t work in master otherwise when you pull changes, you&#8217;ll have a messy merge and when you push you&#8217;ll make a bunch of messy lines in your git tree, and you&#8217;ll get yelled at for making those messy lines.</p>
<p>I want to go through the steps with you to get your git tree to look like one straight line. Look at the model below to understand what you need to do.</p>
<p><img src="http://monsterboxpro.com/blog/wp-content/uploads/2010/02/commit.png" alt="Perfect Git Commit Model"  /></p>
<p><strong>Lets go through the step of adding a new feature:</strong></p>
<p> Make sure we&#8217;re on master</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git checkout master</pre></div></div>

<p>Make sure our master is up-to-date</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git pull</pre></div></div>

<p>Create a new branch called new_feature</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git checkout -b new_feature</pre></div></div>

<p>Make changes and commit as much as you want</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git commit</pre></div></div>

<p><strong>1.</strong> Now we&#8217;re ready to push our changes so lets make sure our<br />
master is up-to-date</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git checkout master
git pull</pre></div></div>

<p><strong>2.</strong> Lets rebase (If everything was up-to-date skip this step)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git checkout new_feature
git rebase master</pre></div></div>

<p><strong>3.</strong> Merge new_feature into your master</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git checkout master
git merge new_feature</pre></div></div>

<p><strong>4.</strong> Push changes</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">git push</pre></div></div>

<p>That&#8217;s all there is to it! Single clean line, nobody is yelling at you, and you can make fun of your coding friends who have never rebased before.</p>
]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2010/02/22/how-to-properly-commit-to-your-git-repository-rebasing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Grouping WordPress Posts by Month</title>
		<link>http://monsterboxpro.com/blog/2009/07/20/grouping-wordpress-posts-by-month/</link>
		<comments>http://monsterboxpro.com/blog/2009/07/20/grouping-wordpress-posts-by-month/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 21:24:39 +0000</pubDate>
		<dc:creator>Andrew Brown</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://monsterboxpro.com/blog/?p=5</guid>
		<description><![CDATA[I wanted to be able to group my posts by months in my wordpress template. I couldn&#8217;t find a quick copy and paste online so I wrote my own snippet of code to achieve that result. I had to endure writing php. Since I&#8217;ve been a Rails Developer I think I&#8217;ve gotten lazier or php [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to be able to group my posts by months in my wordpress template. I couldn&#8217;t find a quick copy and paste online so I wrote my own snippet of code to achieve that result. I had to endure writing php. Since I&#8217;ve been a Rails Developer I think I&#8217;ve gotten lazier or php is archaic.</p>
<p><img class="size-full wp-image-25 alignnone" title="group_by_posts" src="http://monsterboxpro.com/blog/wp-content/uploads/2009/07/group_by_posts.jpg" alt="group_by_posts" width="203" height="253" /></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;archives&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;?php </span>
<span style="color: #009900;">  $months <span style="color: #66cc66;">=</span> $wpdb-&gt;</span>get_results(&quot;SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb-&gt;posts WHERE post_status = 'publish' and post_date <span style="color: #009900;">&lt;<span style="color: #66cc66;">=</span> now<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span> and post_type <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'post'</span> GROUP BY month, year ORDER BY post_date DESC<span style="color: #ff0000;">&quot;);</span>
<span style="color: #009900;">  $posts = $wpdb-&gt;</span></span>get_results(&quot;SELECT id, post_title, MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb-&gt;posts WHERE post_status = 'publish' and post_type = 'post' ORDER BY post_date DESC&quot;);
  foreach($months as $this_month){ ?&gt;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;month&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;&lt;?php echo date<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;F&quot;</span>, mktime<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, $this_month-&gt;</span>month, 1, $this_month-&gt;year)); ?&gt; <span style="color: #009900;">&lt;?php echo $this_month-&gt;</span>year; ?&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
    <span style="color: #009900;">&lt;?php <span style="color: #000066;">for</span> <span style="color: #66cc66;">&#40;</span>$i <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>; $i &lt;<span style="color: #66cc66;">=</span> count<span style="color: #66cc66;">&#40;</span>$posts<span style="color: #66cc66;">&#41;</span>; $i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>?&gt;</span> 
      <span style="color: #009900;">&lt;?php if<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>$this_month-&gt;</span>year == $posts[$i]-&gt;year)<span style="color: #ddbb00;">&amp;&amp;($this_month-&gt;month == $posts[$i]-&gt;month)){?&gt;</span>
<span style="color: #ddbb00;">      &lt;p&gt;&lt;a href=&quot;&lt;?php echo get_permalink($posts[$i]-&gt;id);</span> ?&gt;&quot;&gt;<span style="color: #009900;">&lt;?php echo $posts<span style="color: #66cc66;">&#91;</span>$i<span style="color: #66cc66;">&#93;</span>-&gt;</span>post_title; ?&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
      <span style="color: #009900;">&lt;?php <span style="color: #66cc66;">&#125;</span> ?&gt;</span>
    <span style="color: #009900;">&lt;?php <span style="color: #66cc66;">&#125;</span> ?&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- month --&gt;</span>
  <span style="color: #009900;">&lt;?php <span style="color: #66cc66;">&#125;</span> ?&gt;</span>  
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- archives --&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://monsterboxpro.com/blog/2009/07/20/grouping-wordpress-posts-by-month/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
