I’m big fan of JRuby. The Ruby language’s flexibility with the JVM’s power give to us a big weapon to create amazing applications.
http://www.jruby.org/2013/01/04/jruby-1-7-2.html
I have to say that this one was the best talk about refactoring that I ever watch. I highly recommend it.
While we are waiting for the next release of rack that will come with that fix, I extract a code from a pull request in rack repository and created a monkey patch to fix this problem.
This problem often happens when you are using google analytics or another service
https://gist.github.com/2896202
Last weekend I created a new rubygem to help to build a good api to your application.
With this gem you can separate your models and business logics of your representable resource.
At the github has information about how to use it
https://github.com/lucasallan/representable_resources
Hello everyone,
I just released a new rubygem to access google movies information.
Unfortunately google doest not provide a api interface to access this information. so my gem get the html and use nokogiri to parser it and get the information.
I hope it can be useful for someone. It was fun to working on it and learning more about nokogiri.
https://github.com/lucasallan/google_movies
Hello guys,
After too many problems with wordpress, I’m migrating my blog to tumblr. This process can take a while because I’m in a very full week in my job.
Thanks,
Lucas
First, I’m not here to talk bad things about ruby-debug. For almost all my career as ruby developer I have been using ruby-debug and it works well.
But since I discovered pry my life as ruby developer is more easy. I really recommend you check it out, you probably will love it.
I don’t go talk to much about pry, there is to many documentation out there.
To know more about ruby debug and pry, I strongly recommend you to watch Mastering the ruby debugger by Jim Weirich.
By the way: this post title is based on If you’re using Node.js, you’re doing life wrong.
Hi guys,
I took this month to read some books that I wanna read for a long time.
I created a gist to share which books I’m reading and I’m accepting more suggestions about another books. So I created a goal to read at least 2 books a month, maybe more.
In this month I’m reading Clean Code and Crafting Rails Applications. In a few weeks I will write a review about this books.
Hey guys, It’s a quickly post about how to generate pdf with prawn and google charts. Prawn is a awesome lib in ruby for generating PDF documents and google charts is a API to generate charts. I like to create a class responsible to generate my pdf documents. Here is my implementation:
# encoding: UTF-8
require 'open-uri'
class GenderReportPdf < Prawn::Document
def initialize(mens, womans)
super(top_margin: 70)
add_title
@mens = mens
@womans = womans
add_count
add_image
end
def add_title
text "Report by Gender", size: 28, style: :bold, position: :center
end
def add_count
move_down 20
text "Mens #{@h_count}"
text "Womans #{@m_count}"
end
def add_image
move_down 20
image get_external_image, :position => :center
end
def get_external_image
img = URI.parse(URI.encode("https://chart.googleapis.com/chart?cht=p3&chd=t:#{@mens},#{@womans}&chs=250x100&chl=Mens|Womans")).to_s
img = open(img)
end
end
It’s a simple ruby code, very easy to understand (I guess). In the next post I will show you how to send this report to client using Rails.