[Git] Gitorious on Ubuntu

Par défaut

This is the bash history to install and run Gitorious on a Ubuntu server (you need ruby-dev, rails, mongrel and git-core installed to continue).

Some pitfalls:

  • Texpow is not installing because of Onigurama, so download it and build it from sources
  • Problem: « cannot open shared object file: No such file or directory – /usr/lib/ruby/gems/1.8/gems/oniguruma-1.1.0/lib/oregexp.so« . Solution: sudo ldconfig
git clone git://gitorious.org/gitorious/mainline.git  gitorious
cd gitorious
sudo apt-get install libopenssl-ruby1.8
sudo gem install mime-types textpow -y
cp config/gitorious.sample.yml config/gitorious.yml; nano config/gitorious.yml
nano config/database.yml
rake db:migrate
mongrel_rails start

Then open your browser to http://localhost:3000

[Ruby] TwittLine

Par défaut

There’s always a nice thing to do during insomnia: close all the open ideas you’ve got in mind!

So I wanted to have something working about yesterday Twitter Timezone idea, here is the result after using Twitter4R and Sparklines gems:

TwittLine

The sparkline is only created from my friends last 20 twitts. With so few samples, we can’t really see any ‘timezone‘ effect, but some social behaviors appear:

  • Rush hours: some people twitts mostly during the evening;
  • Exclusives: others have only one or two big peaks, it would mean most of their 20 twitts were written in the same period of the day;
  • Flat twitting: twitts seems equally reparted all along the day.

This experience might be extend in the next days, opening it more to public test, and it’s still looking for your suggestions to improve by itself.

Rails 1.2: keep working with version 1.1.6

Par défaut

Two days ago, www.rubyonrails.com released the new version of rails, with lots of new cool stuff to play with.

And if your old projects are complaining after installing the new version, you just have to un-comment a simple line in your « config/environment.rb »:

  # Specifies gem version of Rails to use when vendor/rails is not present
  RAILS_GEM_VERSION = '1.1.6'

Using RJS templates

Par défaut

Ruby on Rails is a great platform to work with, there is so much niceties for geeks like me. Today has been a great day to work with RJS templates.
You must use RJS templates, just because when you don’t know where to put the view behavior after an action, and because filling a link_to_remote helper with too much parameters is really ugly.

Changing DOM className

Because my application needs to display some dynamic user selection of an avatar, a great way has been to change the CSS className of the selected avatar.
Here is how to do it with RJS:

page.select(".avatar").all() do |element, index|
  page.call 'Element.removeClassName', element, 'selected_avatar'
end

page.call 'Element.addClassName', @avatar, 'selected_avatar'