nitro_boy and many others are using Hackety Hack to learn how to code.

Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website.

Sign up Learn More

funnies by nitro_boy

require 'hpricot'

class Comic
  attr_reader :rss, :title

  def initialize(body)
    @rss = Hpricot.XML(body)
    @title = @rss.at("//channel/title").inner_text
  end

  def items
    @rss.search("//channel/item")
  end

  def latest_image
    @rss.search("//channel/item").first.inner_html.scan(/src="([^"]+\.\w+)"/).first
  end
end

Shoes.app :width => 800, :height => 600 do
  background "#555"

  @title = "Comics Section"
  @feeds = [
    "http://www.arcamax.com/redandrover/channelfeed",
    "http://www.arcamax.com/garfield/channelfeed"
    ]

  stack :margin => 10 do
    title strong(@title), :align => "center", :stroke => "#DFA", :margin => 0


    @feeds.each do |feed|
      download feed do |dl|
        stack :width => "100%", :margin => 10, :border => 1 do
          c = Comic.new dl.response.body
          stack :margin_right => gutter do
            background "#333", :curve => 4
            caption c.title, :stroke => "#CD9", :margin => 4, :align => "center"
          end
          image c.latest_image.first, :margin => 8, :align => "center"
        end
      end
    end
  end
end