<?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>@AstonJ&#039;s Blog</title>
	<atom:link href="http://astonj.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://astonj.com</link>
	<description></description>
	<lastBuildDate>Mon, 18 Feb 2013 13:54:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Capistrano/Whenever gem reporting OptionParser::InvalidOption on deploy</title>
		<link>http://astonj.com/tech/capistranowhenever-gem-reporting-optionparserinvalidoption-on-deploy/</link>
		<comments>http://astonj.com/tech/capistranowhenever-gem-reporting-optionparserinvalidoption-on-deploy/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 23:40:04 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2824</guid>
		<description><![CDATA[If you&#8217;re getting this error (probably after a bundle update), all you need to do is comment out: require &#34;whenever/capistrano&#34; Form your deploy.rb file, then deploy as usual, then uncomment it, and deploy again. Simple huh?]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re getting this error (probably after a bundle update), all you need to do is comment out:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">require &quot;whenever/capistrano&quot;</div></div>
<p>Form your deploy.rb file, then deploy as usual, then uncomment it, and deploy again. Simple huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/capistranowhenever-gem-reporting-optionparserinvalidoption-on-deploy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to recover or reset a lost Postgresql password</title>
		<link>http://astonj.com/tech/how-to-recover-or-reset-a-lost-postgresql-password/</link>
		<comments>http://astonj.com/tech/how-to-recover-or-reset-a-lost-postgresql-password/#comments</comments>
		<pubDate>Thu, 20 Dec 2012 03:45:01 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2818</guid>
		<description><![CDATA[This has been doing my head in all day &#8211; so hopefully it will save some of you the trouble. I&#8217;m on a CentOS box. First thing you want to do is check which version of postgres you have, with: psql --version Which will give you something like: psql (PostgreSQL) 9.2.2 So with that info [...]]]></description>
			<content:encoded><![CDATA[<p>This has been doing my head in all day &#8211; so hopefully it will save some of you the trouble. I&#8217;m on a CentOS box.</p>
<p>First thing you want to do is check which version of postgres you have, with:<br />
<span id="more-2818"></span></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">psql --version</div></div>
<p>Which will give you something like:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">psql (PostgreSQL) 9.2.2</div></div>
<p>So with that info you will know which pg_hba.conf to open, for 9.2 it&#8217;s:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">vim /var/lib/pgsql/9.2/data/pg_hba.conf</div></div>
<p>In that file, change this line:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">local all all md5</div></div>
<p>To:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">local all postgres ident</div></div>
<p>Then, at the command type:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">su - postgres<br />
pg_ctl reload<br />
psql</div></div>
<p>Which will let you log in as postgres, then set your new password with:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ALTER USER postgres WITH ENCRYPTED PASSWORD 'your_password';</div></div>
<p>And then go back to your pg_hba.conf file with:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">vim /var/lib/pgsql/9.2/data/pg_hba.conf</div></div>
<p>And change this line:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">local all postgres ident</div></div>
<p>&#8230;back to:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">local all all md5</div></div>
<p>Then:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pg_ctl reload</div></div>
<p>And that&#8217;s it &#8211; done!</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/how-to-recover-or-reset-a-lost-postgresql-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Vips on CentOS</title>
		<link>http://astonj.com/tech/how-to-install-vips-on-centos-libvips/</link>
		<comments>http://astonj.com/tech/how-to-install-vips-on-centos-libvips/#comments</comments>
		<pubDate>Fri, 07 Sep 2012 16:47:37 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[libvips]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[vips]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2803</guid>
		<description><![CDATA[Vips is a brilliant new image processing library that is reported to be far more efficient than most other image processing libraries out there (such as ImageMagick). To install on CentOS simply: Get the latest files from vips.ecs.soton.ac.uk, eg: wget http://www.vips.ecs.soton.ac.uk/supported/current/vips-7.30.2.tar.gz Then unpack: tar -xzvf vips-7.30.2.tar.gz Then cd into the directory: cd vips-7.30.2 Then enter [...]]]></description>
			<content:encoded><![CDATA[<p>Vips is a brilliant new image processing library that is reported to be far more efficient than most other image processing libraries out there (such as ImageMagick). To install on CentOS simply:<span id="more-2803"></span></p>
<p>Get the latest files from <a href="http://www.vips.ecs.soton.ac.uk" target="_blank">vips.ecs.soton.ac.uk</a>, eg:</p>
<p><span class="nc">wget http://www.vips.ecs.soton.ac.uk/supported/current/vips-7.30.2.tar.gz</span></p>
<p>Then unpack:</p>
<p><span class="nc">tar -xzvf vips-7.30.2.tar.gz</span></p>
<p>Then cd into the directory:</p>
<p><span class="nc">cd vips-7.30.2</span></p>
<p>Then enter <span class="nc">./configure</span> and look for any dependency errors, for me I needed to install glib2, which I did with:</p>
<p><span class="nc">yum install glib2-devel</span></p>
<p>Then <span class="nc">./configure</span> again, and look out for any warnings. If you see something like:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">checking for PNG... no<br />
checking for libpng... libraries (none), headers (none)<br />
configure: WARNING: libpng not found; disabling PNG support</div></div>
<p>Simply do: <span class="nc">yum install libpng-devel</span> for all those that you need. </p>
<p>Once you are happy to proceed, enter:</p>
<p><span class="nc">make</span></p>
<p>and</p>
<p><span class="nc">make install</span></p>
<p>And that&#8217;s it!</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/how-to-install-vips-on-centos-libvips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a user, database, and assign the user to the db in PostgreSQL</title>
		<link>http://astonj.com/tech/how-to-create-a-user-database-and-assign-the-user-to-the-db-in-postgresql/</link>
		<comments>http://astonj.com/tech/how-to-create-a-user-database-and-assign-the-user-to-the-db-in-postgresql/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 21:53:27 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2796</guid>
		<description><![CDATA[Here&#8217;s a quick reference on how to create a user, a database and grant the user all privileges to the database (on Mac OS X). If you haven&#8217;t yet installed PostgreSQL, look here: How to install PostgreSQL on Mac OS X Create user In terminal, enter: createuser -P user_name And follow the instructions &#8211; they&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick reference on how to create a user, a database and grant the user all privileges to the database (on Mac OS X). <em>If you haven&#8217;t yet installed PostgreSQL, look here: <a href="http://astonj.com/tech/how-to-install-postgresql-on-mac-os-x/" title="How to install PostgreSQL on Mac OS X">How to install PostgreSQL on Mac OS X</a></em><br />
<span id="more-2796"></span></p>
<h3>Create user</h3>
<p>In terminal, enter:</p>
<p><span class="nc">createuser -P user_name</span></p>
<p>And follow the instructions &#8211; they&#8217;ll probably be:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; enter password for new role: <br />
&nbsp; &nbsp; Enter it again: <br />
&nbsp; &nbsp; Shall the new role be a superuser? (y/n) n<br />
&nbsp; &nbsp; Shall the new role be allowed to create databases? (y/n) n<br />
&nbsp; &nbsp; Shall the new role be allowed to create more new roles? (y/n) n</div></div>
<h3>Create database</h3>
<p>In terminal, enter:</p>
<p><span class="nc">createdb db_name</span></p>
<h3>Grant privileges to user</h3>
<p>In terminal:</p>
<p><span class="nc">psql db_name</span></p>
<p>Then:</p>
<p><span class="nc">grant all privileges on database db_name to user_name;</span></p>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/how-to-create-a-user-database-and-assign-the-user-to-the-db-in-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install PostgreSQL on Mac OS X</title>
		<link>http://astonj.com/tech/how-to-install-postgresql-on-mac-os-x/</link>
		<comments>http://astonj.com/tech/how-to-install-postgresql-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 15:53:31 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2777</guid>
		<description><![CDATA[There are a number of ways to install Postgres on Mac, here&#8217;s three. While these instructions are for a clean install of Lion, they may work for Mountain Lion. Postgresapp The easy option! Simply go to Postgresapp.com download, and double click &#8211; that&#8217;s it! It also includes PLV8 and PostGIS (see second comment below for [...]]]></description>
			<content:encoded><![CDATA[<p>There are a number of ways to install Postgres on Mac, here&#8217;s three. While these instructions are for a clean install of Lion, they may work for Mountain Lion.<br />
<span id="more-2777"></span></p>
<h3>Postgresapp</h3>
<p>The easy option! Simply go to <a href="http://postgresapp.com/" title="Postgresapp.com" target="_blank">Postgresapp.com</a> download, and double click &#8211; that&#8217;s it! It also includes PLV8 and PostGIS (see second comment below for details). If you want more info about the project, check out <a href="https://github.com/mattt/PostgresApp" title="this" target="_blank">this</a></p>
<h3>Postgres one click installer</h3>
<p>Another easy option! This is a one click installer from The EnterpriseDB PostgreSQL Company. It includes PostgreSQL, pgAdmin, PL/Java and the PL/pgSQL debugger plugin. Note that this creates a new postgresql user on your system &#8211; you may or may not like that</p>
<p>To install, simply download and double click, from <a href="http://www.enterprisedb.com/products-services-training/pgdownload#osx" title="here" target="_blank">here</a>.</p>
<h3>Homebrew</h3>
<p>Homebrew &#8211; the much loved <em>&#8220;missing package manager for OS X&#8221;</em>.</p>
<p>In terminal:</p>
<p><span class="nc">brew install postgresql</span></p>
<p>Then follow the instructions at the end, for me there were:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">initdb /usr/local/var/postgres<br />
<br />
mkdir -p ~/Library/LaunchAgents<br />
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/<br />
&nbsp; launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist</div></div>
<p>And these are handy to note</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Or start manually with:<br />
&nbsp; pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start<br />
<br />
And stop with:<br />
&nbsp; pg_ctl -D /usr/local/var/postgres stop -s -m fast</div></div>
<h3>Which one to use?</h3>
<p>If you want a quick an easy solution, the Postgresapp seems like a good choice &#8211; it just works. If you don&#8217;t mind a new user being created on your system them it might be worth trying the one click installer. If you already use Homebrew then that may be your preferred choice.</p>
<p>Personally I would go with the first or last choice as I&#8217;m not keen on having additional users on my system.</p>
<h3>Install the pg gem</h3>
<p>If you want to install the postgres gem, including ARCHFLAGS is recommended:</p>
<p><span class="nc">env ARCHFLAGS=&#8221;-arch x86_64&#8243; gem install pg</span></p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/how-to-install-postgresql-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Learning Vim</title>
		<link>http://astonj.com/tech/learning-vim/</link>
		<comments>http://astonj.com/tech/learning-vim/#comments</comments>
		<pubDate>Tue, 03 Jul 2012 01:22:47 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2646</guid>
		<description><![CDATA[If you&#8217;re interested in learning Vim you&#8217;re in luck &#8211; because there are some great resources out there. In this post I&#8217;m going to document the ones I&#8217;ve been using, in a step-by-step kinda way &#8211; hopefully making it easy to follow for anyone else keen on learning. By the end of it, you should [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re interested in learning Vim you&#8217;re in luck &#8211; because there are some great resources out there. In this post I&#8217;m going to document the ones I&#8217;ve been using, in a step-by-step kinda way &#8211; hopefully making it easy to follow for anyone else keen on learning. By the end of it, you should (hopefully) no longer be a novice <img src='http://astonj.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<span id="more-2646"></span></p>
<h3>Step one &#8211; learn the basics</h3>
<p>First I suggest you have a quick read of my last <a href="http://astonj.com/tech/vim-for-ruby-rails-and-a-sexy-theme/">Vim post</a> which acts as a bit of an overview, and why Vim is so good &#8211; especially for Rails development.</p>
<p>Then, type <span class="nc">vimtutor</span> into your terminal and follow the tutorial &#8211; which is fairly short, but easy and fun!</p>
<h3>Step two &#8211; see it in action</h3>
<p>And pick up a thing or two along the way! <a href="http://www.derekwyatt.org" target="_blank">Derek Wyatt</a>&#8216;s Vim tutorials are pretty awesome. He&#8217;s a funny guy who keeps the videos informative and interesting&#8230; you never know what he might say or do next &#8211; in one for example, he shares that he has no pants on! Crazy nutta! lol.</p>
<p>- <a href="http://vimeo.com/6170479" target="_blank">Basic Movement &#8211; 1</a></p>
<p>- <a href="http://vimeo.com/6185584" target="_blank">Basic Movement &#8211; 2</a></p>
<p>- <a href="http://vimeo.com/6216655" target="_blank">Basic Movement &#8211; 3</a></p>
<p>- <a href="http://vimeo.com/6329762" target="_blank">Basic Editing &#8211; 1</a></p>
<p>- <a href="http://vimeo.com/6332848" target="_blank">Basic Editing &#8211; 2</a></p>
<p>- <a href="http://vimeo.com/6306508" target="_blank">Working with many files &#8211; 1</a></p>
<p>- <a href="http://vimeo.com/6307101" target="_blank">Working with many files &#8211; 2</a></p>
<p>- <a href="http://vimeo.com/6342264" target="_blank">Working with many files &#8211; 3</a></p>
<p>There are lots more on his site &#8211; but this was enough for me for now. Step 3 is where we start reinforcing some of this stuff.</p>
<h3>Step three &#8211; do, repeat, reinforce</h3>
<p>Firstly, start using Vim as your main editor &#8211; that&#8217;s when things will start sticking. But also, for the next week or so, read the following once every night (it&#8217;s basically some key points from Derek&#8217;s screencasts). Repeating will help reinforce and cement the commands into your brain. Mwwhahahaaaaa.</p>
<p><strong>Movement</strong></p>
<p><span class="nc">f</span><span class="nc">/</span> goes to first character after the f on that line &#8211; in this and most of the following cases that&#8217;s a forward slash (/)<br />
<span class="nc">;</span> repeats the above (to the next forward slash)<br />
<span class="nc">t</span><span class="nc">/</span> goes to just before (till) the character<br />
<span class="nc">;</span> repeats the above<br />
<span class="nc">F</span><span class="nc">/</span> goes backwards<br />
<span class="nc">T</span><span class="nc">/</span> goes until backwards<br />
<span class="nc">4f</span><span class="nc">/</span> go to fourth specified character</p>
<p><span class="nc">ct</span><span class="nc">/</span> change till character<br />
<span class="nc">c2t</span><span class="nc">c</span> change until second c (replace 2 with any number)<br />
<span class="nc">4f</span><span class="nc">/</span> go to fourth character (/)</p>
<p><span class="nc">CTRL U</span> move up half a page<br />
<span class="nc">CTRL D</span> move down half a page</p>
<p><span class="nc">H</span> go to head (top) of screen (does not change text position on screen)<br />
<span class="nc">M</span> go to middle of screen<br />
<span class="nc">L</span> go to last (bottom) of screen<br />
<span class="nc">48G</span> got to line 48</p>
<p><span class="nc">*</span> changes current word into a search term, hit <span class="nc">n</span> for next word.<br />
<span class="nc">#</span> same as above, but goes backwards<br />
<span class="nc">N</span> in either of the above, changes direction<br />
<span class="nc">g*</span> case insensite of <span class="nc">*</span><br />
<span class="nc">g#</span> matches part words</p>
<p><span class="nc">/</span><span class="nc">WORD</span> manual search (replace word with what you want to find)<br />
<span class="nc">?</span><span class="nc">WORD</span> backwards search</p>
<p><span class="nc">%</span> go to matching bracket</p>
<p><span class="nc">v</span> visual mode<br />
<span class="nc">V</span> visual mode &#8211; by line</p>
<p><span class="nc">ma</span> mark line<br />
You can then go to wherever you want, use <span class="nc">Y</span> to copy the line, and then use <span class="nc">&#8216;a</span> to go back, and then use <span class="nc">p</span> to paste.</p>
<p><span class="nc">&#8216;</span><span class="nc">&#8216;</span> goes back to the line you were on, eg, after a <span class="nc">M</span> or <span class="nc">20G</span>.<br />
<span class="nc">`</span><span class="nc">`</span> goes back to the exact character you were on.</p>
<p><strong>Editing</strong></p>
<p><span class="nc">I</span> insert at start of line<br />
<span class="nc">A</span> append at the end of the line<br />
<span class="nc">i</span> insert at position<br />
<span class="nc">a</span> append (just after position)<br />
<span class="nc">o</span> insert in line below<br />
<span class="nc">O</span> insert in line above</p>
<p><span class="nc">x</span> delete at cursor<br />
<span class="nc">X</span> delete before cursor (like a backspace)<br />
<span class="nc">dd</span> delete line<br />
<span class="nc">.</span> repeat (eg <span class="nc">dd&#8230;..</span>)<br />
<span class="nc">dw</span> delete to next word from cursor (includes whitespace up to next word)<br />
<span class="nc">diw</span> delete inner word &#8211; deletes from start of word to end of word (leaves whitespace)<br />
<span class="nc">daw</span> delete a word &#8211; deletes from start of word to start of next word (inlcudes whitespace)<br />
<span class="nc">de</span> delete to end of word only</p>
<p><span class="nc">cw</span> change word (or to end of word)<br />
<span class="nc">c$</span> change to end of line<br />
<span class="nc">cc</span> change entire line<br />
<span class="nc">r</span> replace single character<br />
<span class="nc">R</span> replace/overwrite from<br />
<span class="nc">c2w</span> change two words<br />
<span class="nc">3r</span> change 3 chracters<br />
<span class="nc">s</span> substitute (delete) character at cursor and go into insert mode<br />
<span class="nc">s</span> substitute (delete) entire line and go into insert mode<br />
<span class="nc">yy</span> yank (copy) line<br />
<span class="nc">Y</span> yank (copy) line<br />
<span class="nc">P</span> paste to line below<br />
<span class="nc">yw</span> yank word<br />
<span class="nc">J</span> join to line below seperated by a space (can be repeated &#8211; you can also highlight a number of lines and join them)<br />
<span class="nc">6Y</span> yank 6 lines</p>
<p><span class="nc">gUiw</span> make current word uppercase<br />
<span class="nc">guiw</span> make current word lowercase</p>
<p><span class="nc">CTRL V</span> block highlight<br />
<span class="nc">CTRL V</span><span class="nc">e</span> block highlight to end of word<br />
From here you can move around(/highligh) as usual, then do something like <span class="nc">i</span> to insert some text and then when you click escape it will insert the text to the block you highlighted. You can do any editing, such as <span class="nc">cw</span>, <span class="nc">x</span>, <span class="nc">r</span> etc<br />
<span class="nc">gv</span> repeats previous block (handy if you need to re-edit the same block)</p>
<p><span class="nc">CTRL n</span> auto-completion (start typing a word) next completion<br />
<span class="nc">CTRL p</span> auto-completion (start typing a word) previous completion</p>
<p><strong>Buffers</strong></p>
<p>Buffers are really cool. Vim keeps track of all the files you&#8217;ve opened in a &#8216;buffer&#8217;. So you can easily go back to files as and when you need to &#8211; without having to have squillions of tabs or windows open. Being a TextMate tab-a-holic, I love them &#8211; as I can see they are going to be much more useful.</p>
<p><span class="nc">:ls</span> lists buffers<br />
<span class="nc">:b</span> followed by number or name of file (can use TAB for autocompletion) &#8211; to go to that buffer.<br />
<span class="nc">:b#</span> flip to last buffer (and again to flip back)<br />
<span class="nc">:bd</span> deletes current buffer<br />
<span class="nc">:bd</span> <span class="nc">23</span> delete buffer 23<br />
<span class="nc">:bd</span> <span class="nc">file-name</span> delete buffer file-name<br />
<span class="nc">:bd</span> <span class="nc">23 44</span> deletes buffers 23 and 44<br />
<span class="nc">:bd</span> <span class="nc">file-1 file-2</span> deletes buffers named file-1 and file-2<br />
<span class="nc">:22,26</span> <span class="nc">bd</span> deletes buffers in range from 22 to 26</p>
<p><span class="nc">:wall</span> write all<br />
<span class="nc">:bn</span> next buffer<br />
<span class="nc">:be</span> previous buffer<br />
<span class="nc">:bfirst</span> first buffer<br />
<span class="nc">:blast</span> last buffer</p>
<p><strong>Windows</strong></p>
<p>Windows are <strong>not</strong> buffers. So two windows with the same file equals the same buffer. Closing the window does not close the buffer (but closing a buffer can close the window that the buffer is shown in).  </p>
<p><span class="nc">:sp</span> split window<br />
<span class="nc">:vsp</span> split window vertically<br />
<span class="nc">:sp</span> <span class="nc">file-name</span> split window with file name.<br />
<span class="nc">CTRL W</span> <span class="nc">s</span> split window<br />
<span class="nc">CTRL W</span> <span class="nc">v</span> split window vertically<br />
<span class="nc">CTRL W</span> <span class="nc">j</span> move to lower window<br />
<span class="nc">CTRL W</span> <span class="nc">h</span> move to left window<br />
<span class="nc">CTRL W</span> <span class="nc">c</span> close window<br />
<span class="nc">CTRL W</span> <span class="nc">K</span> move window above/span/span</p>
<p><strong>Step 4 &#8211; you decide</strong></p>
<p>There&#8217;s so much more to learn, but it really depends on which aspect of Vim you want to go deeper with. I&#8217;ll probably watch the rest of Derek&#8217;s videos, because they keep my interest &#8211; and he&#8217;s kinda mad which makes it all the more compelling.</p>
<p>Here&#8217;s a <a href="http://jrmiii.com/attachments/Vim.pdf" target="_blank">Vim mind map</a> (PDF) that you might want to download and keep as a reference &#8211; I found it on <a href="http://jrmiii.com/2009/03/06/learning-vim-the-pragmatic-way.html" target="_blank">Joe Martinez</a>&#8216;s site.</p>
<p>Well, good luck! I hope you&#8217;ll enjoy Vim as much as I think I will, and if I come across more resources that I think are worth sharing, I&#8217;ll be sure to add them here./span etc<br />
span class=&#8221;nc&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/learning-vim/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vim for Ruby on Rails (and a sexy theme!)</title>
		<link>http://astonj.com/tech/vim-for-ruby-rails-and-a-sexy-theme/</link>
		<comments>http://astonj.com/tech/vim-for-ruby-rails-and-a-sexy-theme/#comments</comments>
		<pubDate>Thu, 28 Jun 2012 01:47:29 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2519</guid>
		<description><![CDATA[This post started off as a small guide mainly for my own reference, but it&#8217;s grown into a good overview of why Vim is so great for Rails development &#8211; if you&#8217;re unconvinced, just read through the killer commands listed below&#8230; you&#8217;ll soon see how Vim could make life a lot easier for you &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>This post started off as a small guide mainly for my own reference, but it&#8217;s grown into a good overview of why Vim is so great for Rails development &#8211; if you&#8217;re unconvinced, just read through the killer commands listed below&#8230; you&#8217;ll soon see how Vim could make life a lot easier for you &#8211; and I&#8217;m only scratching the surface here!<br />
<span id="more-2519"></span></p>
<h3>Basic install</h3>
<p>First up, install <a title="Macvim" href="http://code.google.com/p/macvim/" target="_blank">MacVim</a> (or <a href="http://www.vim.org/" target="_blank">Vim</a> for your platform)</p>
<p>Then install the <a href="https://github.com/carlhuda/janus" target="_blank">Janus: Vim Distribution</a> which is the defacto Rails Vim distro.</p>
<h3>Adding the CodeSchool theme</h3>
<p>Although Janus comes with plenty of themes, I prefer my old TextMate theme (which I created to mimic the CodeSchool theme used in their Rails Best Practises course) &#8230;it&#8217;s just so easy on the eye, and going by my stats, quite popular.</p>
<p><img class="alignCenter size-full wp-image-2531" title="vim-theme" src="http://astonj.com/wp-content/uploads/2012/06/vim2.png" alt="" width="581" height="511" /></p>
<p>You can see what a full page looks like by clicking <a href="http://twitpic.com/a18fuo/full" target="_blank">here</a> <em>(Note: I have since added a slight background to the line numbers as I feel that makes it easier to see indentation levels).</em></p>
<p>Download the theme from <a href="http://astonj.com/wp-content/uploads/2012/06/codeschool.vim2_.zip">here</a>, unzip it and place the codeschool.vim file in <span class="nc">~/.vim/colors</span></p>
<p>Then, open <span class="nc">~/.gvimrc.after</span>and inside that paste (and save):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">color codeschool<br />
set guifont=Monaco:h12<br />
let g:NERDTreeWinPos = &quot;right&quot;<br />
set guioptions-=T &quot; Removes top toolbar<br />
set guioptions-=r &quot; Removes right hand scroll bar<br />
set go-=L &quot; Removes left hand scroll bar<br />
autocmd User Rails let b:surround_{char2nr('-')} = &quot;&lt;% \r %&gt;&quot; &quot; displays &lt;% %&gt; correctly<br />
:set cpoptions+=$ &quot; puts a $ marker for the end of words/lines in cw/c$ commands</div></div>
<p>To add some breathing space at the top, in terminal type:<br />
<span class="nc">defaults write org.vim.MacVim MMTextInsetTop &#8217;5&#8242;</span></p>
<p>Ok that&#8217;s the theme sorted. You might have noticed I moved the NERDTree to the right hand side, which is where I prefer it &#8211; if you prefer the left omit that line.</p>
<h3>Some basics</h3>
<p>First, pick up the basics by going to your command line and typing <span class="nc">vimtutor</span> (and enter). It&#8217;s a really good, albeit short, introduction. Then (for those of us coming from tab-based editors) here&#8217;s a few tips you might find handy:</p>
<p><span class="nc">CTRL W</span><span class="nc">w</span> moves you from window to window (i.e nerdtree to window and vice versa)<br />
<span class="nc">CTRL W</span><span class="nc">T</span> moves current window into a tab</p>
<p><span class="nc">t</span> (While in nerdtree) opens the file in a tab.</p>
<p><span class="nc">gt</span> Goes to next tab.</p>
<p><span class="nc">gT</span> Goes to previous tab.</p>
<p><span class="nc">\n</span> Toggles the NerdTree on or off.</p>
<p><span class="nc">Command T</span> Similar to TextMate&#8217;s find in project. Try to navigate by directory rather than file name. While there <span class="nc">CTRL T</span> opens in a tab, or <span class="nc">Escape</span> closes it.</p>
<p><span class="nc">df [character]</span> deletes to character, eg <span class="nc">df_</span> will delete to the next underscore</p>
<p><strong>I just want to add that although</strong> the above covers tabs, tab&#8217;s are one thing you will probably use quite <strong>differently</strong> in Vim&#8230; Vim has a really awesome package of buffers + tabs + split windows &#8211; which will probably mean a different, more flexible and pleasant workflow <img src='http://astonj.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I might do a blog post about it later (stay tuned!) but for now just be prepared to move away from endless tabs &#8211; if that&#8217;s what you were used to before.</p>
<p>Here are are the erb tags:</p>
<p><span class="nc">CTRL S =</span> <%= %> erb tags<br />
<span class="nc">CTRL S -</span> <% -%> erb tags<br />
<span class="nc">CTRL S #</span> <%# %> erb tags</p>
<h3>Some killer commands</h3>
<p>Here is the first batch of killer commands I have found &#8211; do you know more? Please let me know and I&#8217;ll add them! Most of these come courtesy of <strong>Tim Pope</strong> and his <strong>rails.vim</strong> plug-in (which is installed with Janus).</p>
<p><span class="nc">:Rmodel dog</span> you can replace &#8216;model&#8217; with controller or view (or helper, test, etc) and then enter the name of the controller or view you want. Pretty awesome huh?</p>
<p><span class="nc">:Rmodel</span> will take you to the associated Model depending on which file you are in. Also works with: <span class="nc">:Rcontroller</span> <span class="nc">:Renvironment</span> <span class="nc">:Rfixtures</span> <span class="nc">:Rhelper</span> <span class="nc">:Rjavascript</span> <span class="nc">:Rlayout</span> <span class="nc">:Rlib</span> <span class="nc">:Rmailer</span> <span class="nc">:Rmigration</span> <span class="nc">:Rmodel</span> <span class="nc">:Robserver</span> <span class="nc">:Rtask</span> <span class="nc">:Rview</span> <span class="nc">:Rspec</span></p>
<p><span class="nc">:Rfind file-name</span> will take you to the file directly.</p>
<p><span class="nc">:Rgenerate (options)</span> same as <span class="nc">rails g</span> in terminal.</p>
<p><span class="nc">:A</span> goes to the alternate file (eg the associated test file)<br />
<span class="nc">:AS</span> same as above, but in split<br />
<span class="nc">:AV</span> same as above, but in vertical split</p>
<p><span class="nc">:R</span> goes to the related file, so if the cursor is on the &#8216;show&#8217; method of a controller &#8211; it will take you to the show view.<br />
<span class="nc">:RS</span> same as above, but in split<br />
<span class="nc">:RV</span> same as above, but in vertical split</p>
<p><span class="nc">gf</span> &#8211; go to related file depending on where your cursor is (see :R above)<br />
<span class="nc">CTRL W</span><span class="nc">gf</span> same as above but in a new tab<br />
<span class="nc">CTRL W</span><span class="nc">f</span> same as above but in new split window.</p>
<p><span class="nc">:Rake task-name</span> runs the rake task</p>
<p>There are <strong>lots</strong> more &#8211; check out the Rails.vim link below for them all.</p>
<p><span class="nc">:NERDTreeFind</span> will show you the location of the file you are in, inside NERDTree (and open NERDTree if it is not open). <em>Thanks to Rafał for that tip!</em></p>
<p>While in NERDTree, press <span class="nc">m</span> for menu &#8211; then you can add/delete/rename etc <em>Thanks to Les for that tip!</em></p>
<p><span class="nc">Command-Shift-F</span> find in project (though you need &#8216;Ack&#8217; for this to work &#8211; on Mac, install with <span class="nc">brew install ack</span>) <em>Thanks to Chris for this tip!</em></p>
<p><span class="nc">:sp</span> splits your screen (can be used multiple times)</p>
<p><span class="nc">:vsp</span> splits your screen as above &#8211; but vertically.</p>
<p>Be sure to check out the &#8216;Learning Vim&#8217; link below &#8211; there, I post tips on how you can master the basics of Vim, easily and quickly.</p>
<h3>Further reading</h3>
<p>- <a href="http://blog.danielfischer.com/2010/11/19/a-starting-guide-to-vim-from-textmate/" target="_blank">Daniel Fishcher&#8217;s TextMate to Vim post</a></p>
<p>- <a href="http://robots.thoughtbot.com/post/166073596/intro-rails-vim" target="_blank">Thoughtbot&#8217;s Intro to Rails Vim video</a></p>
<p>- <a href="https://github.com/tpope/vim-rails/blob/master/doc/rails.txt" target="_blank">Rails.vim awesome command list</a></p>
<p>- <a href="http://astonj.com/tech/learning-vim/">Learning Vim (by me)</a></p>
<p>Well that&#8217;s it for now, I hope this post has shown you not only how to set up Vim, but a few of the basic commands as well as some of the killer features that makes Vim so great for Rails development. I hope you&#8217;ll have as much fun with it as I think I will!</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/vim-for-ruby-rails-and-a-sexy-theme/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>How to get Capistrano to ignore upload directories (Carrierwave)</title>
		<link>http://astonj.com/tech/how-to-get-capistrano-to-ignore-upload-directories-carrierwave/</link>
		<comments>http://astonj.com/tech/how-to-get-capistrano-to-ignore-upload-directories-carrierwave/#comments</comments>
		<pubDate>Sat, 23 Jun 2012 18:29:55 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2508</guid>
		<description><![CDATA[As you probably know, Capistrano creates a fresh directory for your app every time you deploy a new version. So if you want some directories (or files) to be carried through to each version, such as files uploaded by users, then we just need to tell Capistrano that they are shared &#8211; and to use [...]]]></description>
			<content:encoded><![CDATA[<p>As you probably know, Capistrano creates a fresh directory for your app every time you deploy a new version. So if you want some directories (or files) to be carried through to each version, such as files uploaded by users, then we just need to tell Capistrano that they are <em>shared</em> &#8211; and to use the /shared directory for these files instead. Which is done by creating symbolic links. Here&#8217;s how.</p>
<p>Add this to your deploy.rb file:<br />
<span id="more-2508"></span></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set :shared_children, shared_children + %w{public/uploads}</div></div>
<p>That will create the symbolic link. So all files uploaded to current/public/uploads actually get stored (and called from) the shared/uploads directory.</p>
<p>Then run deploy:setup to set it up:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cap deploy:setup</div></div>
<p>You have to make sure these directories are not tracked by Git. Which is easy enough you just add them to the .gitignore file:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># Ignore uploaded files<br />
/public/uploads</div></div>
<p>However, if Git is already tracking (or has previously tracked) the directory, you will need to remove it, with:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">git rm -r --cached public/uploads</div></div>
<p>The <em>&#8211;cached</em> option doesn&#8217;t touch your working directory (so public/uploads will remain there).</p>
<p>That&#8217;s it! <img src='http://astonj.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/how-to-get-capistrano-to-ignore-upload-directories-carrierwave/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apple did not invent &#8216;Retina&#8217; displays &#8211; we did</title>
		<link>http://astonj.com/tech/apple-did-not-invent-retina-displays-we-did/</link>
		<comments>http://astonj.com/tech/apple-did-not-invent-retina-displays-we-did/#comments</comments>
		<pubDate>Mon, 11 Jun 2012 15:50:29 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[dell]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2503</guid>
		<description><![CDATA[Some of us have been running &#8216;retina&#8217; displays long before Apple dreamed of them, and here&#8217;s how you can too. What you need A monitor with a tiny dot pitch and large enough resolution (and size) and an inbuilt scaler. What this basically means is a monitor with a very high resolution, but where the [...]]]></description>
			<content:encoded><![CDATA[<p>Some of us have been running &#8216;retina&#8217; displays long before Apple dreamed of them, and here&#8217;s how you can too.<br />
<span id="more-2503"></span><br />
<strong>What you need</strong></p>
<p>A monitor with a tiny dot pitch and large enough resolution (and size) and an inbuilt scaler. What this basically means is a monitor with a very high resolution, but where the text is pretty small when set to the native resolution. For example a 30&#8243; Dell (native screen res of 2560 x 1600)</p>
<p><strong>What you do</strong></p>
<p>Simply set the scale options on the monitor to &#8216;aspect&#8217;, and set your computer to run it at 1920 x 1200.</p>
<p><strong>What you get</strong></p>
<p>A super smooth, super slick display. Which you can position at a comfortable viewing distance (like the back of your desk, not the middle where it&#8217;s right up to your nose!).</p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/apple-did-not-invent-retina-displays-we-did/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Intro to Git &#8211; 5 mins to see why it&#8217;s awesome</title>
		<link>http://astonj.com/tech/intro-to-git-5-mins-to-see-why-its-awesome/</link>
		<comments>http://astonj.com/tech/intro-to-git-5-mins-to-see-why-its-awesome/#comments</comments>
		<pubDate>Sat, 09 Jun 2012 00:41:36 +0000</pubDate>
		<dc:creator>AstonJ</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://astonj.com/?p=2468</guid>
		<description><![CDATA[This is more a handy reference for myself, but it also acts as a very quick intro to why git is awesome and well worth using. The main difference here is I remind you what the state of your working directory is as you make changes (as this was what confused me previously &#8211; as [...]]]></description>
			<content:encoded><![CDATA[<p>This is more a handy reference for myself, but it also acts as a very quick intro to why git is awesome and well worth using. The main difference here is I remind you what the state of your working directory is as you make changes (as this was what confused me previously &#8211; as I wasn&#8217;t quite sure what was going on).<em> I assume you&#8217;ve installed git already &#8211; and know what it is.</em><br />
<span id="more-2468"></span><br />
Although we&#8217;ll create a demo Rails app, this applies to any app/directory.</p>
<h3>Git Basics</h3>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Rails new gitdemo<br />
cd git demo<br />
# Create app and cd into the directory<br />
<br />
git init <br />
# Starts git repository<br />
<br />
git add . <br />
# Adds all files<br />
<br />
git status <br />
# Shows status<br />
<br />
git commit -m &quot;Initial commit&quot;<br />
# Commits what you've done. -m specifies you want to add a message, which is put in &quot;&quot;.<br />
<br />
git log<br />
# Shows a log of what you've done</div></div>
<h3>Working with branches/versions</h3>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">git checkout -b trying-something-out<br />
# Creates a new branch called trying-something-out<br />
# Branches are great because they let you work on forks, and make it easy to undo changes<br />
<br />
# For example<br />
<br />
rm -rf app/<br />
# That will delete the 'app' directory<br />
## State of your actual directory - the 'app' folder is not there<br />
<br />
git status<br />
# Shows you what you've done<br />
<br />
git checkout -f<br />
# restores you back to the previous state (keeps you in current branch tho)<br />
## State of your actual directory - the 'app' folder is now back</div></div>
<h3>To get rid of a branch altogether</h3>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rm -rf app/<br />
git commit -am &quot;Some changes made&quot;<br />
# commits with flag '-am' which means commit all with a message<br />
## State of your actual directory - the 'app' folder is not there<br />
<br />
# Here's how to get it back:<br />
<br />
git checkout master<br />
# Switches you back to the master branch<br />
## State of your actual directory - the 'app' folder is back!<br />
<br />
git branch<br />
# Shows you which branch you are on<br />
<br />
git branch -D trying-something-out<br />
# Deletes branch</div></div>
<h3>To apply changes to the master branch</h3>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">git checkout -b removing-tmp<br />
rm -rf tmp/<br />
# We create a branch and then delete the tmp directory<br />
## State of your actual directory - the 'tmp' folder is not there<br />
<br />
git checkout master<br />
# Takes you back to master<br />
## State of your actual directory - the 'tmp' folder is still not there<br />
<br />
git merge removing-tmp<br />
# Applies changes to the master branch<br />
## State of your actual directory - the 'tmp' folder is still not there<br />
<br />
git branch -d removing-tmp<br />
# Notice the small 'd' - will only delete after a successful merge</div></div>
<p>Just note that changes are not saved to your repo until you add them (such as with git add .) and then commit them.</p>
<p>I&#8217;ve had all this in my notes for a while &#8211; I can&#8217;t remember where they came from now but think it was TheRailsTutorial.com <img src='http://astonj.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://astonj.com/tech/intro-to-git-5-mins-to-see-why-its-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
