Good repository descripton = more wachers

All my repos that have a bad or unclear description have few watchers. Why? Because many of them are not found through google, but from people that watch one of my plugins and have a look at the rest. Any repository that does not clearly state its use, within the 3 seconds of read it gets, is not looked at further.

  • Which architecture does it use ? – prefix with e.g. Rails: AR: jQuery:
  • What does it do? – clear, short explanation

Bad — When Active Record objects are saved from a form, empty fields are saved as empty strings instead of nil. This kills most validations.

Good — AR: store empty strings as NULL, making queries + conditions simpler and code more robust

And now ill continue renaming… 😉

OpenID is complex and limited. Use RPX.

I just finished a RPXNow Rails plugin and gem
so that everyone can enjoy the great usability + simplicity of RPX

Use OpenId / Google / Yahoo / MySpace / Facebook connect transparently through the same interface.

Usage

#login.erb
RPXNow.embed_code('mywebsite',url_for(:controller=>:session, :action=>:rpx_token))

#sessions_controller.rb
def rpx_token
  data = RPXNow.user_data(params[:token],'YOUR RPX API KEY')
  self.current_user = User.find_by_identifier(data[:identifier]) || User.create!(data)
  redirect_to '/'
end

Doing the same with OpenId is impossible, since every provider has his own standards of which fields to supply and how to name them.

Happy login!

How much Memory does my Ruby Script use ?

I could not find any in-ruby solution for this question, so here is a unix-solution.

def memory
  pid = Process.pid
  map = `pmap -d #{pid}`
  map.split("\n").last
end

Output

mapped: 17652K    writeable/private: 2180K    shared: 0K

Lesson learned
Use `open(file).each(seperator)` over `open(file).read.split(seperator)` if you want to optimize for memory (is slightly slower)