Tag Archives: programming

How to read Google buzz updates in Ruby 0

require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'feedzirra'

profile_name = 'dave.winer'
page = Nokogiri::HTML(open("http://www.google.com/profiles/#{profile_name}"))

feed_url = page.search('//head/link[@type="application/atom+xml"]').first['href']
feed = Feedzirra::Feed.fetch_and_parse(feed_url)

puts feed.title
puts feed.url
puts feed.last_modified

feed.entries.each do |entry|
puts
puts "Title: #{entry.title}"
puts "Content"
puts entry.content
end

I can’t find the Activity Streams tag. Feedzirra could be filtering it but I haven’t look at it yet.

Coding gems 11-20 0

#11 Either you code it so simple there are obviously no deficiencies or so complicated that there are no obvious deficiencies
#12 In a room full of expert software designers, if any two agree, that’s a majority. Bill Curtis
#13 When in doubt, use brute force. Butler Lampson
#14 You are not in the business of developing software. [...]

Coding gems 1-10 0

#1 The more dogmatic you are about applying a design method, the fewer real-life problems you are going to solve – P.J. Plauger
#2 Let Ruby be Ruby. Let Java be Java. Let Python be Python. Don’t expect it to be Erlang, because it isn’t.
#3.1 Plan to throw one away; you will, anyhow. – Fred Brooks
#3.2 [...]

How to create Google-friendly URLs in Rails 4

If you are building content-management systems or any applications with pages that you want to appear in a Google search, it is very important that you employ search engine optimization techniques or SEO. One such technique involves URLs.
Given a default URL in Rails, e.g. http://cia.gov/users/123, we know as developers that this request involves the [...]

How to share code between Javascript and Rails 2

Rails’ validations is great because it allows you to quickly implement the valid states of your models and at the same time have a ready-made way of displaying the errors to your users. For example, below is a screenshot of a registration form written with just a few lines of code:

However, this approach requires [...]