In my current Silverlight project the amount of JavaScript is growing exponentially. Everything that I took for granted in Flash which took years to build and “perfect” now needed to be converted to JavaScript.

For the first beta release which is looming next week, the amount is about 130k. “Compressing” it with JSMin yields a file of 75kb in size. Yesterday I tried YUI Compressor which managed to squeeze it down to 65kb.

I’m very happy I no longer have to look at JSMin code which induces gag reflex and makes my eyes bleed. The amount of effort and self restraint it took not to rewrite it can not be described in words.

It’s nice to do some Ruby once in a while. Lately I’ve been involved in a Silverlight project and haven’t touched Ruby in 2 months (hence the lack of activity on my Ruby blog). However, I’m making a build script in Ruby.

I have run into a weird exception when using my favorite IO gem RIO (btw, Noobkit page got beaten with the ugly stick and parser needs a spanking).

Exception occur when calling rio(...).rmtree or rio(...).mkpath or rio(...).mkdir. It reads as follows: “wrong number of arguments (0 for 1)”. I know for a fact that these methods don’t take any arguments, but just for kicks, passing a single random argument results in an ironic “wrong number of arguments (1 for 0)”.

Basically the problem came down to the fact that RIO doesn’t like Rake. I can live without Rake, but not without RIO.

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Ruby

Web Development

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Ruby

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Ruby

Web Development

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Web Development

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Software

I looked all over and couldn’t find a bash script which could check and if missing install a list of gems. I had to hack my own up:

GEMS=( `cat gems.txt` ) # gems.txt has one gem name per line

for gem in "${GEMS[@]}"; do
  found=`gem list $gem | grep -i $gem`
  if [ "$found" != "" ]; then
    parts=( $found )
    echo "Found ${parts[0]} ${parts[1]}"
    continue
  fi

  echo "---------------------------"
  echo "Installing $gem"
  sudo gem install $gem -y
  echo "---------------------------"
done

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

GUI edition

  • Shoes - a lightweight Ruby interface to Windows, Linux and OSX applications. Best for small utilities. (into one, two and three by Juxie)
  • Cheri::Swing - a full blow JRuby builder style interface to Java’s Swing.
  • Ruby-GNOME2 - bindings for the GNOME 2.0 development environment.
  • WxRuby - allows writing native-looking desktop applications for Windows, OS X, Linux GTK and other platforms. Probably the most complete GUI package.
  • FXRuby - provides an interface to the FOX GUI library.
  • RubyCocoa - OSX bindings for Ruby.
  • VisualuRuby - Windows bindings for Ruby.
  • Linux GUI Programming with Ruby - a short video demonstrating Glade based Linux GUI with Ruby.

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Ruby

Web Development

Sometimes you want to focus on just one example in your RSpec file. I had to do this quite often in the last 3 days and I got tired of commenting out stuff back and forth. So, I give you “it_only” example.

module Spec
  module DSL
    module BehaviourEval
      module ModuleMethods
        def it(description = :__generate_description, opts = {}, &block)
          return if @it_only_found
          examples << Example.new(description, opts, &block)
        end

        # Same as +it+ only blocks all other examples making this the
        # only example that would run.
        def it_only(description = :__generate_description, opts = {}, &block)
          @it_only_found = true
          @examples = [Example.new(description, opts, &block)]
        end
      end
    end
  end
end

Drop this into your spec_helper.rb and now if you want to focus on a single example, just make it “it_only” instead of “it“.

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Ruby

Web Development

Misc

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Web Development

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Ruby

Web Development

I’ve recently started experimenting with using Ubuntu for my Ruby development. Some of the Gems like JSON and HPricot have extension compilation step which doesn’t work on a default Ubuntu installation.

Here are a few steps that you need to get it to work.

  1. Open up Synaptic Package Manager from System > Preferences
  2. Search for “ruby1.8-dev”, right click and check “Mark for installation”
  3. Search for “build-essential” and mark it for installation as well
  4. Click “Apply” in the toolbar

After the update is finished, you should be able to install Gems which require native extensions compilation.