<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>My Pragmatic life</title>
	<atom:link href="http://grosser.it/feed/" rel="self" type="application/rss+xml" />
	<link>http://grosser.it</link>
	<description>Building web applications and fighting the daily madness -- Michael Grosser</description>
	<lastBuildDate>Tue, 24 Jan 2012 21:18:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='grosser.it' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>My Pragmatic life</title>
		<link>http://grosser.it</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://grosser.it/osd.xml" title="My Pragmatic life" />
	<atom:link rel='hub' href='http://grosser.it/?pushpress=hub'/>
		<item>
		<title>Prevent ActionMailer from sending to deleted users / blacklisted addresses</title>
		<link>http://grosser.it/2011/12/22/prevent-actionmailer-from-sending-to-deleted-users-blacklisted-addresses/</link>
		<comments>http://grosser.it/2011/12/22/prevent-actionmailer-from-sending-to-deleted-users-blacklisted-addresses/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 10:11:11 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Mail]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1890</guid>
		<description><![CDATA[No need to check in normal code, just do everything as usual and this interceptor will prevent you from spamming people who do not want any emails. Its not perfect(missing bc/bcc filters but if should be fine for 90% of cases) #config/initializers/blacklisted_emails.rb class MailInterceptor def self.delivering_email(message) if User.where(:email =&#62; message.to, :receive_emails =&#62; false).any? message.perform_deliveries = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1890&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>No need to check in normal code, just do everything as usual and this interceptor will prevent you from spamming people who do not want any emails.<br />
Its not perfect(missing bc/bcc filters but if should be fine for 90% of cases)</p>
<pre style="font-size:12px;overflow:auto;">
#config/initializers/blacklisted_emails.rb
class MailInterceptor
  def self.delivering_email(message)
    if User.where(:email =&gt; message.to, :receive_emails =&gt; false).any?
      message.perform_deliveries = false
    end
  end
end

Mail.register_interceptor(MailInterceptor)
</pre>
<br /> Tagged: <a href='http://grosser.it/tag/mail/'>Mail</a>, <a href='http://grosser.it/tag/rails/'>Rails</a>, <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1890/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1890&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/12/22/prevent-actionmailer-from-sending-to-deleted-users-blacklisted-addresses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>You dont need RSpec in :development</title>
		<link>http://grosser.it/2011/12/11/you-dont-need-rspec-for-development/</link>
		<comments>http://grosser.it/2011/12/11/you-dont-need-rspec-for-development/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 17:52:07 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1885</guid>
		<description><![CDATA[You can speed up development load time and get rid of rspec in development if you simply not require it in :development and just load the tasks in the Rakefile where they are needed. # Gemfile group :development, :test do gem 'rspec-rails', :require =&#62; false end # Rakefile require File.expand_path('../config/application', __FILE__) require 'rspec-rails' if ['test', [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1885&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can speed up development load time and get rid of rspec in development if you simply not require it in :development and just load the tasks in the Rakefile where they are needed.</p>
<pre style="overflow:auto;font-size:12px;">
# Gemfile
group :development, :test do
  gem 'rspec-rails', :require =&gt; false
end

# Rakefile
require File.expand_path('../config/application', __FILE__)
require 'rspec-rails' if ['test', 'development'].include?(Rails.env)
...
</pre>
<p>Repeat for any other testing lib for even more speedup <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /> Tagged: <a href='http://grosser.it/tag/rails/'>Rails</a>, <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1885/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1885&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/12/11/you-dont-need-rspec-for-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Running tests via spork directly from Rubymine</title>
		<link>http://grosser.it/2011/12/06/running-tests-via-spork-directly-from-rubymine/</link>
		<comments>http://grosser.it/2011/12/06/running-tests-via-spork-directly-from-rubymine/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 03:48:59 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1874</guid>
		<description><![CDATA[Very fast test execution from inside Rubymine. Cmd+F8 + 2 seconds == test results 1 Activate DRB in Rubymine Run &#62; Edit configurations &#62; Defaults &#62; RSpec &#62; Use DRB Server 2 a) Start spork from Rubymine Tools &#62; Run Spork DRB Server 2 b) (alternatively) start spork from the commandline Code # spec/spec_helper.rb Spork.prefork [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1874&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Very fast test execution from inside Rubymine.<br />
Cmd+F8 + 2 seconds == test results <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><b>1 Activate DRB in Rubymine</b><br />
Run &gt; Edit configurations &gt; Defaults &gt; RSpec &gt; Use DRB Server</p>
<p><b>2 a) Start spork from Rubymine</b><br />
Tools &gt; Run Spork DRB Server</p>
<p><b>2 b) (alternatively) start spork from the commandline</b><br />
<b>Code</b></p>
<pre style="font-size:12px;overflow:auto;">
  # spec/spec_helper.rb
Spork.prefork do
  if ENV["RUBYMINE_HOME"]
    puts "Rubymine support"
    $:.unshift(File.expand_path("rb/testing/patch/common", ENV["RUBYMINE_HOME"]))
    $:.unshift(File.expand_path("rb/testing/patch/bdd", ENV["RUBYMINE_HOME"]))
  end
end
</pre>
<p>and run it via:</p>
<pre style="font-size:12px;">
RUBYMINE_HOME=/Applications/Rubymine\ 3.2.4.app/ spork
</pre>
<br /> Tagged: <a href='http://grosser.it/tag/rails/'>Rails</a>, <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1874/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1874&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/12/06/running-tests-via-spork-directly-from-rubymine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Capybara: use current_path_info instead of current_path / current_url</title>
		<link>http://grosser.it/2011/11/26/capybara-use-current_path_info-instead-of-current_path-current_url/</link>
		<comments>http://grosser.it/2011/11/26/capybara-use-current_path_info-instead-of-current_path-current_url/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 03:41:22 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Capybara]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1864</guid>
		<description><![CDATA[Capybara has current_url, which returns an url that is unmatcheable since it includes a randomized port, and current_path with contains neither query nor fragment(aka hash/anchor) and is therefore rather useless. Behold the perfect current_path_info, which returns the full path and query + fragment. Code def current_path_info current_url.sub(%r{.*?://},'')[%r{[/\?\#].*}] &#124;&#124; '/' end Tagged: Capybara<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1864&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Capybara has current_url, which returns an url that is unmatcheable since it includes a randomized port, and current_path with contains neither query nor fragment(aka hash/anchor) and is therefore rather useless.</p>
<p>Behold the perfect current_path_info, which returns the full path and query + fragment.</p>
<p><b>Code</b></p>
<pre style="font-size:12px;">
def current_path_info
  current_url.sub(%r{.*?://},'')[%r{[/\?\#].*}] || '/'
end
</pre>
<br /> Tagged: <a href='http://grosser.it/tag/capybara/'>Capybara</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1864/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1864&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/11/26/capybara-use-current_path_info-instead-of-current_path-current_url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding travis hook to new github project via the commandline</title>
		<link>http://grosser.it/2011/11/20/adding-travis-hook-to-new-github-project-via-the-commandline/</link>
		<comments>http://grosser.it/2011/11/20/adding-travis-hook-to-new-github-project-via-the-commandline/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 01:12:22 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1854</guid>
		<description><![CDATA[I got tired of clicking through the github menus, so after some toying around with the octopi github client (which does not work as expected&#8230;), I wrote this small script using pure rest-client. Creates a new travis hook based on the travis info in your .gitconfig and also triggers the initial test-run. add to ~/.gitconfig [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1854&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I got tired of clicking through the github menus, so after some toying around with the octopi github client (which does not work as expected&#8230;), I wrote this small script using pure rest-client.</p>
<p>Creates a new travis hook based on the travis info in your .gitconfig<br />
and also triggers the initial test-run.</p>
<p><b>add to ~/.gitconfig</b></p>
<pre style="font-size:12px;">
[travis]
  user = xxx
  token = yyy
</pre>
<p><b>download &amp; run the <a href="https://github.com/grosser/dotfiles/blob/master/bin/github-add-travis">Script</a></b><br />
wget https://raw.github.com/grosser/dotfiles/master/bin/github-add-travis</p>
<p>./github-add-travis github-password project-name</p>
<br /> Tagged: <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1854/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1854&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/11/20/adding-travis-hook-to-new-github-project-via-the-commandline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Switching form Public Domain to MIT</title>
		<link>http://grosser.it/2011/10/27/switching-for-public-domain-to-mit/</link>
		<comments>http://grosser.it/2011/10/27/switching-for-public-domain-to-mit/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 23:00:21 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1848</guid>
		<description><![CDATA[All my new projects will be released under MIT / those I work on will be switched, which will still means the same as before: Do wtf you want with this code, no need for any naming/license copying. After reading some articles I realized that public domain does not always work since some countries do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1848&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>All my new projects will be released under MIT / those I work on will be switched, which will still means the same as before: Do wtf you want with this code, no need for any naming/license copying.</p>
<p>After reading some <a href="http://stackoverflow.com/questions/219742/open-source-why-not-release-into-public-domain">articles</a> I realized that public domain does not always work since some countries do not allow it and its also unclear what happens when the code causes problems &lt;-&gt;  lawsuit.</p>
<p>Ill also try to add a s.license = &#8216;MIT&#8217; to all gemspecs, to make license management easier.</p>
<br /> Tagged: <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1848/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1848&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/10/27/switching-for-public-domain-to-mit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>A fresh start with Ubuntu Oneiric Ocelot 11.10</title>
		<link>http://grosser.it/2011/10/17/a-fresh-start-with-ubuntu-oneiric-ocelot-11-10/</link>
		<comments>http://grosser.it/2011/10/17/a-fresh-start-with-ubuntu-oneiric-ocelot-11-10/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 15:49:17 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[install]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1815</guid>
		<description><![CDATA[A fresh install for my laptop, with some Desktop tools and all the rails/ruby stuff I need. Choose a short name for your computer, it will later show in the prompt. Only enter your firstname/alias, it will always show in the toolbar. Enable canonical partners in &#8220;Software Sources&#8221; &#62; Other Software Install RBEnv sudo apt-get [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1815&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A fresh install for my laptop, with some Desktop tools and all the rails/ruby stuff I need.</p>
<ol>
<li>Choose a short name for your computer, it will later show in the prompt. Only enter your firstname/alias, it will always show in the toolbar.</li>
<li>Enable canonical partners in &#8220;Software Sources&#8221; &gt; Other Software</li>
<li>Install <a href="https://github.com/sstephenson/rbenv">RBEnv</a>
<pre style="font-size:12px;overflow:auto;">
sudo apt-get install curl zlib1g-dev libssl-dev libreadline6-dev libncursesw5-de libxml2 libxml2-dev libxslt1-dev libsqlite3-dev -y
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' &gt;&gt; ~/.bashrc
echo 'eval "$(rbenv init -)"' &gt;&gt; ~/.bashrc
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
sudo ./install.sh
rbenv install # choose which rubies you want (atm ree is broken...)

# rbenvsudo
function rbenvsudo(){
  executable=$1
  shift 1
  sudo $(rbenv which $executable) $*
}
</pre>
</li>
<li><b><a href="http://www.jetbrains.com/ruby/index.html">Rubymine</a></b> to /opt/rubymine
<p>Command key:<br />
Choose &#8220;meta is mapped to left win&#8221; in advanced keyboard layout options</p>
<p>Executable:<br />
/opt/rubymine/bin/rubymine.sh and setup mine as executable then</p>
<pre style="font-size:12px;overflow:auto;">
alias m="mine . &gt; /dev/null 2&gt;&amp;1 &amp;"
</pre>
<p>Fix multi-clipboard issues:</p>
<pre style="font-size:12px;overflow:auto;">
echo 'idea.use.alt.clipboard.sync=true' &gt;&gt; /opt/rubymine/bin/idea.properties
</pre>
<p>Sun-java: It is no longer in ubuntu repos.</p>
<pre style="font-size:12px;">
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre
export RUBYMINE_JDK="/usr/lib/jvm/java-6-sun/jre"
</pre>
</li>
<li>Map unity menu from super to Super+z, so you can use it with shortcuts (see below) and with rubymine commands<br />
sudo apt-get install compizconfig-settings-manager -y<br />
open compiz application and rebind unity laucher @ &#8220;ubuntu unity plugin&#8221;, dont mess with anything else, I managed to make ubuntu no longer boot into a GUI with just a few clicks
</li>
<li><b>Shortcuts</b><br />
Super+D = desktop<br />
Super+E = open home<br />
Super+Up = maximize<br />
Super+Down = minimize<br />
Super+Q = quit application (Alt+F4)</p>
<li><b>Chrome</b> sudo apt-get install chromium-browser -y</li>
<li><b>Git</b> sudo apt-get install git-core</li>
<li><b>Ruco</b> commandline editor gem install ruco</li>
<li>copy important dotfiles + firefox history/forms/&#8230; database from .mozilla</li>
<li><a href="http://github.com/grosser/dotfiles">dotfiles</a></li>
<li><b>Multi-clipboard</b> sudo apt-get install clipit<br />
(set history shortcut: Ctrl+Alt+V)</li>
<li><a href="http://www.skype.com/intl/en/download/skype/linux/choose/">Skype</a> + add skype to startup<br />
(video fix in <a href="https://github.com/grosser/dotfiles">dotfiles</a> &#8211;&gt; add add /home/xxxx/dotfiles/bin/video-skype to &#8220;Startup Spplications&#8221; )
</pre>
</li>
<li>Mysql:<br />
sudo apt-get install mysql-server mysql-client libmysql-ruby libmysqlclient-dev -y<br />
I`d recommend no root password
</li>
<li><b>Redis</b> sudo apt-get install redis-server -y</li>
<li><b>Memcached</b> sudo apt-get install memcached</li>
<li><b>ImageMagic</b> sudo apt-get install imagemagick libmagick9-dev -y</li>
<li>Arial/Verdana etc fonts:   sudo apt-get install msttcorefonts</li>
<li><a href="http://www.virtualbox.org/wiki/Linux_Downloads">VirtualBox</a></li>
<li><a href="http://grosser.it/2010/05/22/one-liner-to-install-nginx-with-passenger-and-ssl/">Nginx + Passenger</a></li>
<li><b>Restrcited codes</b> sudo apt-get install ubuntu-restricted-extras -y</li>
<li>
<b>Terminal</b><br />
Set Ctrl+Shift+L for clear+reset in terminal, so the history gets removed on keypress<br />
Set Ctrl+t for new tab
</li>
<li>
<b>Postgres</b><br />
sudo apt-get install postgresql postgresql-devel<br />
gem install pg</p>
<p># change /etc/postgresql/9.1/main/pg_hba.conf from peer to trust<br />
local   all             postgres                                trust</p>
<p>sudo /etc/init.d/postgresql restart</p>
<p>use username: postgres + no password in database.yml</p>
</li>
<li>
<b>Reverse scrolling</b><br />
If you often work on macs this can reduce your confusion.<br />
sudo add-apt-repository ppa:zedtux/naturalscrolling<br />
sudo apt-get update<br />
sudo apt-get install naturalscrolling -y
</li>
</ol>
<br /> Tagged: <a href='http://grosser.it/tag/ubuntu/'>Ubuntu</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1815/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1815/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1815/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1815/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1815/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1815/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1815/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1815&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/10/17/a-fresh-start-with-ubuntu-oneiric-ocelot-11-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby Money vs nil &#8212; aka undefined method `round&#8217; for nil:NilClass</title>
		<link>http://grosser.it/2011/10/13/ruby-money-vs-nil-aka-undefined-method-round-for-nilnilclass/</link>
		<comments>http://grosser.it/2011/10/13/ruby-money-vs-nil-aka-undefined-method-round-for-nilnilclass/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 13:12:11 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1803</guid>
		<description><![CDATA[Problem When using composed_of with Money you get this nice error when trying to get the money object while the cents column is nil. Additionally Money.new(nil) does not work, neither do strings like Money.new(params[:cents]). Solution Overwrite the initializer to also accept nil and strings # config/initializers/money.rb require 'money' class Money def initialize_with_default_currency(*args) args[0] = args[0].to_i [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1803&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b>Problem</b><br />
When using composed_of with Money you get this nice error when trying to get the money object while the cents column is nil.<br />
Additionally Money.new(nil) does not work, neither do strings like Money.new(params[:cents]).</p>
<p><b>Solution</b><br />
Overwrite the initializer to also accept nil and strings</p>
<pre style="font-size:12px;overflow:auto;">
# config/initializers/money.rb
require 'money'
class Money
  def initialize_with_default_currency(*args)
    args[0] = args[0].to_i if args[0].is_a?(String) or args[0].blank?
    args[1] ||= Money.default_currency
    initialize_without_default_currency(*args)
  end
  alias_method_chain :initialize, :default_currency
end
</pre>
<br /> Tagged: <a href='http://grosser.it/tag/rails/'>Rails</a>, <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1803/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1803/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1803/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1803/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1803/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1803/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1803/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1803/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1803&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/10/13/ruby-money-vs-nil-aka-undefined-method-round-for-nilnilclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>rake version:bump:patch in the age of bundler gemspecs</title>
		<link>http://grosser.it/2011/10/04/rake-versionbumppatch-in-the-age-of-bundler-gemspecs/</link>
		<comments>http://grosser.it/2011/10/04/rake-versionbumppatch-in-the-age-of-bundler-gemspecs/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 12:42:00 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1782</guid>
		<description><![CDATA[A great timesaver in jeweler is rake version:bump:xxx, it bumps the version and commits the result. After switching my project-template to bundler, I kind of missed it &#8230; so I made a standalone version The Gist of it&#8230; # extracted from https://github.com/grosser/project_template rule /^version:bump:.*/ do &#124;t&#124; sh "git status &#124; grep 'nothing to commit'" # [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1782&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A great timesaver in <a href="https://github.com/technicalpickles/jeweler">jeweler</a> is rake version:bump:xxx, it bumps the version and commits the result. After switching my <a href="https://github.com/grosser/project_template">project-template</a> to bundler, I kind of missed it &#8230; so I made a standalone version <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="https://gist.github.com/1261469">The Gist of it&#8230;</a></p>
<pre style="overflow:auto;font-size:12px;">
# extracted from https://github.com/grosser/project_template
rule /^version:bump:.*/ do |t|
  sh "git status | grep 'nothing to commit'" # ensure we are not dirty
  index = ['major', 'minor','patch'].index(t.name.split(':').last)
  file = 'lib/GEM_NAME/version.rb'

  version_file = File.read(file)
  old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
  version_parts[index] = version_parts[index].to_i + 1
  version_parts[2] = 0 if index &lt; 2
  version_parts[1] = 0 if index &lt; 1
  new_version = version_parts * &#039;.&#039;
  File.open(file,&#039;w&#039;){|f| f.write(version_file.sub(old_version, new_version)) }

  sh &quot;bundle &amp;&amp; git add #{file} Gemfile.lock &amp;&amp; git commit -m &#039;bump version to #{new_version}&#039;&quot;
end
</pre>
<br /> Tagged: <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1782/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1782&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/10/04/rake-versionbumppatch-in-the-age-of-bundler-gemspecs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby: Converting html colors (24bit) to xterm/terminal colors</title>
		<link>http://grosser.it/2011/09/16/ruby-converting-html-colors-24bit-to-xtermterminal-colors/</link>
		<comments>http://grosser.it/2011/09/16/ruby-converting-html-colors-24bit-to-xtermterminal-colors/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 19:01:45 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://grosser.it/?p=1777</guid>
		<description><![CDATA[Convert nice html color codes into terminal colors e.g. to make ruco colorful COLOR_SOURCE_VALUES = 256 COLOR_TARGET_VALUES = 5 COLOR_DIVIDE = COLOR_SOURCE_VALUES / COLOR_TARGET_VALUES TERM_COLOR_BASE = 16 # '#ff0000' =&#62; 196 def self.html_to_terminal_color(html_color) return unless html_color r = (html_color[1..2].to_i(16) / COLOR_DIVIDE) * 36 g = (html_color[3..4].to_i(16) / COLOR_DIVIDE) * 6 b = (html_color[5..6].to_i(16) / COLOR_DIVIDE) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1777&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Convert nice html color codes into <a href="http://www.mudpedia.org/wiki/Xterm_256_colors">terminal colors</a><br />
e.g. to make <a href="http://twitter.com/#!/grosser/status/114076360938500096/photo/1">ruco</a> colorful <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<pre style="font-size:12px;overflow:auto;">
    COLOR_SOURCE_VALUES = 256
    COLOR_TARGET_VALUES = 5
    COLOR_DIVIDE = COLOR_SOURCE_VALUES / COLOR_TARGET_VALUES
    TERM_COLOR_BASE = 16

    # '#ff0000' =&gt; 196
    def self.html_to_terminal_color(html_color)
      return unless html_color
      r = (html_color[1..2].to_i(16) / COLOR_DIVIDE) * 36
      g = (html_color[3..4].to_i(16) / COLOR_DIVIDE) * 6
      b = (html_color[5..6].to_i(16) / COLOR_DIVIDE) * 1
      TERM_COLOR_BASE + r + g + b
    end
</pre>
<br /> Tagged: <a href='http://grosser.it/tag/ruby/'>Ruby</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/1777/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/1777/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pragmatig.wordpress.com/1777/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pragmatig.wordpress.com/1777/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/1777/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/1777/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/1777/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/1777/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grosser.it&amp;blog=2921704&amp;post=1777&amp;subd=pragmatig&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grosser.it/2011/09/16/ruby-converting-html-colors-24bit-to-xtermterminal-colors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
	</channel>
</rss>
