<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Lucas Catón » English</title>
	
	<link>http://blog.lucascaton.com.br</link>
	<description>Ruby, Rails, Linux, Mac OSX, iOS and Objective C</description>
	<lastBuildDate>Wed, 23 May 2012 02:54:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/lucascaton_english" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="lucascaton_english" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>My dotfiles</title>
		<link>http://blog.lucascaton.com.br/?p=1266</link>
		<comments>http://blog.lucascaton.com.br/?p=1266#comments</comments>
		<pubDate>Mon, 30 Apr 2012 01:11:02 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[dotfiles]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=1266</guid>
		<description><![CDATA[Finally I created a repository with my dotfiles. Dotfiles are configurations files, usually with their names beginning with a dot (hidden files) and located in your home directory (~/). The repository is: https://github.com/lucascaton/dotfiles Check the instructions in the link above, &#8230; <a href="http://blog.lucascaton.com.br/?p=1266">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Finally I created a repository with my dotfiles.</p>
<p>Dotfiles are configurations files, usually with their names beginning with a dot (hidden files) and located in your home directory (~/).</p>
<p>The repository is: <a href="https://github.com/lucascaton/dotfiles" target="_blank"><strong>https://github.com/lucascaton/dotfiles</strong></a></p>
<p>Check the instructions in the link above, in order to get the dotfiles.</p>
<p>The dotfiles are focused on the Ruby language, but there&#8217;s also Git and PostgreSQL configuration files. I&#8217;ve included files as .bash_profile, .gitconfig, .irbrc (using <a href="http://pry.github.com/" target="_blank">pry</a>), .pryrc, .psqlrc and .rvmrc. There is also a list of ruby gems (file &#8220;default.gems&#8221;).</p>
<p>My <strong>vimfiles</strong> can be found at: <a href="https://github.com/lucascaton/vimfiles" target="_blank">https://github.com/lucascaton/vimfiles</a></p>
<p>I have tested it only in OSX 10.7, but it should work in any *nix without problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=1266</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regex to match Youtube URLs (using Ruby)</title>
		<link>http://blog.lucascaton.com.br/?p=1256</link>
		<comments>http://blog.lucascaton.com.br/?p=1256#comments</comments>
		<pubDate>Tue, 10 Apr 2012 14:19:34 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=1256</guid>
		<description><![CDATA[I created a regular expression in order to match Youtube URLs. Currently, the most common URLs from Youtube are http://youtube.com and http://youtu.be: This regex will match: http://youtube.com/watch?v=1234567890 https://youtube.com/watch?v=1234567890 http://www.youtube.com/watch?v=1234567890 https://www.youtube.com/watch?v=1234567890 http://youtu.be/1234567890 https://youtu.be/1234567890 http://www.youtu.be/1234567890 https://www.youtu.be/1234567890 http://www.youtube.com/watch?v=1234567890&#038;feature=context&#038;context=G2de15aaFAAAAAAAAAAA www.youtube.com/watch?v=1234567890 youtube.com/watch?v=1234567890 youtu.be/1234567890 And won&#8217;t &#8230; <a href="http://blog.lucascaton.com.br/?p=1256">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I created a regular expression in order to match Youtube URLs.</p>
<p>Currently, the most common URLs from Youtube are <strong>http://youtube.com</strong> and <strong>http://youtu.be</strong>:</p>
<pre class="brush: ruby; title: ; notranslate">/(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?(\w{10,})/</pre>
<p>This regex will match:</p>
<ul>
<li>http://youtube.com/watch?v=1234567890</li>
<li>https://youtube.com/watch?v=1234567890</li>
<li>http://www.youtube.com/watch?v=1234567890</li>
<li>https://www.youtube.com/watch?v=1234567890</li>
<li>http://youtu.be/1234567890</li>
<li>https://youtu.be/1234567890</li>
<li>http://www.youtu.be/1234567890</li>
<li>https://www.youtu.be/1234567890</li>
<li>http://www.youtube.com/watch?v=1234567890&#038;feature=context&#038;context=G2de15aaFAAAAAAAAAAA</li>
<li>www.youtube.com/watch?v=1234567890</li>
<li>youtube.com/watch?v=1234567890</li>
<li>youtu.be/1234567890</li>
</ul>
<p>And won&#8217;t match:</p>
<ul>
<li>youtube.com</li>
<li>youtube.com/</li>
<li>youtube.com/watch</li>
<li>youtube.com/watch/</li>
<li>youtu.be</li>
<li>youtu.be/</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=1256</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to remove several lines in the Vim editor using Regex</title>
		<link>http://blog.lucascaton.com.br/?p=902</link>
		<comments>http://blog.lucascaton.com.br/?p=902#comments</comments>
		<pubDate>Tue, 06 Sep 2011 13:31:28 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=902</guid>
		<description><![CDATA[A quick tip for those using the Vim editor: if you need to remove several lines that match your regular expression, just use the command: Example: If you want to remove the commented lines: Just execute: And then, your text &#8230; <a href="http://blog.lucascaton.com.br/?p=902">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A quick tip for those using the Vim editor: if you need to remove several lines that match your regular expression, just use the command:</p>
<pre class="brush: bash; title: ; notranslate">:g /pattern/d</pre>
<p>Example: If you want to remove the commented lines:</p>
<pre class="brush: ruby; title: ; notranslate"># this is a comment
def whatever
end

# this is another comment
def other_method
end</pre>
<p>Just execute:</p>
<pre class="brush: bash; title: ; notranslate">:g /^#.*/d</pre>
<p>And then, your text will look like this:</p>
<pre class="brush: ruby; title: ; notranslate">def whatever
end

def other_method
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=902</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My new gem: “code2pdf”</title>
		<link>http://blog.lucascaton.com.br/?p=813</link>
		<comments>http://blog.lucascaton.com.br/?p=813#comments</comments>
		<pubDate>Thu, 02 Jun 2011 19:11:18 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[code2pdf]]></category>
		<category><![CDATA[gem]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=813</guid>
		<description><![CDATA[About My newest gem code2pdf is a simple and open-source tool for convert your source code to a PDF file. It can be useful if you need to licence you software. Installation Usage Open a terminal and run: BlackList file &#8230; <a href="http://blog.lucascaton.com.br/?p=813">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>About</h3>
<p>My newest gem <a href="https://github.com/lucascaton/code2pdf"><strong>code2pdf</strong></a> is a simple and open-source tool for convert your source code to a PDF file. It can be useful if you need to licence you software.</p>
<h3>Installation</h3>
<pre class="brush: bash; title: ; notranslate">gem install code2pdf</pre>
<h3>Usage</h3>
<p>Open a terminal and run:</p>
<pre class="brush: bash; title: ; notranslate">code2pdf &lt;project path&gt; &lt;blacklist file&gt;</pre>
<h3>BlackList file example:</h3>
<p>The blacklist file must be a yaml file, as such:</p>
<pre class="brush: bash; title: ; notranslate">:directories:
  - .git
  - db/migrate
  - doc
  - log
  - public/images
  - public/system
  - script
  - spec
  - tmp
  - vendor
:files:
  - .DS_Store
  - .eprj
  - .gitignore
  - .rspec
  - .rvmrc
  - database.yml
  - development.sqlite3
  - application.yml
  - favicon.ico
  - controls.js
  - dragdrop.js
  - effects.js
  - prototype.js
  - rails.js</pre>
<h3>PDF output example</h3>
<p><a href="https://github.com/lucascaton/code2pdf/raw/master/examples/example.pdf">example.pdf</a></p>
<p>Please, let me know if you liked or hated it :)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=813</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My Vimfiles</title>
		<link>http://blog.lucascaton.com.br/?p=776</link>
		<comments>http://blog.lucascaton.com.br/?p=776#comments</comments>
		<pubDate>Tue, 24 May 2011 23:36:18 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimfiles]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=776</guid>
		<description><![CDATA[Usage Troubleshoot: Because of the large amount of submodules, if you ever have any trouble after pulling from the repository, it will be easier to just back up your old .vim folder and just git clone a new version. Clone &#8230; <a href="http://blog.lucascaton.com.br/?p=776">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>Usage</h3>
<p>Troubleshoot: Because of the large amount of submodules, if you ever have any trouble after pulling from the repository, it will be easier to just back up your old .vim folder and just git clone a new version.</p>
<p>Clone this repo into your home directory either as .vim (linux/mac) or vimfiles (Windows). Such as:</p>
<pre class="brush: bash; title: ; notranslate">git clone git://github.com/lucascaton/vimfiles.git ~/.vim</pre>
<p>Then ‘cd’ into the repo and run this to get the snippets submodule:</p>
<pre class="brush: bash; title: ; notranslate">git submodule init
git submodule update</pre>
<p>Now just copy (or symlink) the .vim/vimrc file as .vimrc (Mac/Linux) or copy as _vimrc (Windows) in your home directory. In Mac and Linux, the<br />
easiest thing to do is:</p>
<pre class="brush: bash; title: ; notranslate">ln -s ~/.vim/vimrc ~/.vimrc</pre>
<p>If you already have a custom .vimrc file, append the following lines to load everything else along with your personal hacks:</p>
<pre class="brush: bash; title: ; notranslate">source ~/.vim/vimrc      &quot;linux
source ~/vimfiles/vimrc  &quot;windows</pre>
<p>Project source: <a href="https://github.com/lucascaton/vimfiles">https://github.com/lucascaton/vimfiles</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=776</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to test mailers in Rails 3 with RSpec</title>
		<link>http://blog.lucascaton.com.br/?p=574</link>
		<comments>http://blog.lucascaton.com.br/?p=574#comments</comments>
		<pubDate>Mon, 25 Oct 2010 22:19:04 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[mailer]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=574</guid>
		<description><![CDATA[The ActionMailer module was reconstructed in Rails 3 and the way to test it is a little different. Now, the mailers has a itself subdirectory (on app/) and it&#8217;s look like the controllers. Assuming we&#8217;ve a mailer to send same &#8230; <a href="http://blog.lucascaton.com.br/?p=574">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <strong>ActionMailer</strong> module was reconstructed in <strong>Rails 3</strong> and the way to test it is a little different. Now, the mailers has a itself subdirectory (on <strong>app/</strong>) and it&#8217;s look like the controllers.</p>
<p>Assuming we&#8217;ve a mailer to send same information:</p>
<pre class="brush: ruby; title: ; notranslate">
class Notifier &lt; ActionMailer::Base
  default :from =&gt; 'noreply@company.com'

  def instructions(user)
    @name = user.name
    @confirmation_url = confirmation_url(user)
    mail :to =&gt; user.email, :subject =&gt; 'Instructions'
  end
end
</pre>
<p>To send an email through a method from User class:</p>
<pre class="brush: ruby; title: ; notranslate">
class User
  def send_instructions
    Notifier.instructions(self).deliver
  end
end
</pre>
<p>Before test it, make sure the <strong>config/environments/test.rb</strong> file is configured as follows:</p>
<pre class="brush: ruby; title: ; notranslate">
AppName::Application.configure do
  config.action_mailer.delivery_method = :test
end
</pre>
<p>This ensures that emails won&#8217;t send, but store on <strong>ActionMailer::Base.deliveries</strong> array. After, just create the tests:</p>
<p><strong>spec/models/user_spec.rb</strong></p>
<pre class="brush: ruby; title: ; notranslate">
require 'spec_helper'

describe User do
  before :each do
    @user = User.make
  end

  it &quot;sends a e-mail&quot; do
    @user.send_instructions
    ActionMailer::Base.deliveries.last.to.should == [@user.email]
  end
end
</pre>
<p><strong>spec/mailers/notifier_spec.rb</strong></p>
<pre class="brush: ruby; title: ; notranslate">
require 'spec_helper'

describe Notifier do
  describe 'instructions' do
    let(:user) { mock_model(User, :name =&gt; 'Lucas', :email =&gt; 'lucas@email.com') }
    let(:mail) { Notifier.instructions(user) }

    #ensure that the subject is correct
    it 'renders the subject' do
      mail.subject.should == 'Instructions'
    end

    #ensure that the receiver is correct
    it 'renders the receiver email' do
      mail.to.should == [user.email]
    end

    #ensure that the sender is correct
    it 'renders the sender email' do
      mail.from.should == ['noreply@empresa.com']
    end

    #ensure that the @name variable appears in the email body
    it 'assigns @name' do
      mail.body.encoded.should match(user.name)
    end

    #ensure that the @confirmation_url variable appears in the email body
    it 'assigns @confirmation_url' do
      mail.body.encoded.should match(&quot;http://aplication_url/#{user.id}/confirmation&quot;)
    end
  end
end
</pre>
<p>In conclusion, Rails 3 allows you to create very comprehensive tests for mailers without using plugins or gems to facilitate such tests, which were common in Rails 2.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=574</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Java vs Ruby on Rails (by Rails Envy) [legendado]</title>
		<link>http://blog.lucascaton.com.br/?p=16</link>
		<comments>http://blog.lucascaton.com.br/?p=16#comments</comments>
		<pubDate>Wed, 15 Jul 2009 13:08:45 +0000</pubDate>
		<dc:creator>Catón</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Portuguese]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.lucascaton.com.br/?p=16</guid>
		<description><![CDATA[Final do ano passado eu mandei para o Lucas Borges e ele traduziu, e agora eu adaptei a legenda.]]></description>
			<content:encoded><![CDATA[<p><span>Final do ano passado eu mandei para o <a href="http://www.loudnheavy.net/?page_id=41" target="_blank">Lucas Borges</a> e ele traduziu, e agora eu adaptei a legenda.</span></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/SsYKd37r26s&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/SsYKd37r26s&amp;hl=en&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucascaton.com.br/?feed=rss2&amp;p=16</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

