Check out the archive →
fousa blog
And we are back! Still alive and kicking! A lot happend in the mean time... I changed my job (I now work for 10to1), went on an awesome holiday in Slovakia. And I did a lot of soaring. I hope to find more time to do some blogging.
European date text field plugin
This is a small plugin for when you want to use a textfield to enter a European formatted date like DD/MM/YYYY, and validate to this format. HOWTO Clone the plugin into your vendor/plugins directory like this: git clone http://github.com/fousa/european-date-text-field.git Next you should define the columns that need time conversi...
Humanize time field plugin
This is a small plugin to use time input in your textfields and convert them automatically to integer values in your database. HOWTO Clone the plugin into your vendor/plugins directory like this: git clone http://github.com/fousa/humanize-time-field.git Next you should define the columns that need time conversion in your model ob...
My Rails templates
Ruby on Rails has a nice feature where you can generate a new rails project with a template. My templates are based on the newest version of Rails at the moment: Rails 3.0.0beta At the moment my templates handle: jQuery integration git git push to Github HAML integration HTTP basic authentication single password authentication ...
Enumerables in Ruby 1.9
CYCLE You can continue to iterate through an array. array = [1, 2, 3] array.cycle { |element| ... } This code snippet continues to iterate through the array. EACH_WITH_OBJECT The each_with_object method is almost the same as the inject method. The only thing that is different is that you don't have to return the inject...
Other stuff in Ruby 1.9
TAB When you want to output each value of an array while returning the same array. prices = [1, 2, 3] prices.tab { |price| puts price } This is not that special, but you could do some chaining with other methods. prices.tab { |price| puts price }.select { ... } Could come in handy when debugging your application. INSTA...
Pushed my first gem to the RubyGems repository! You can find it here. It's a gem that handles date input in a textfield, more info later!
Enumerators in Ruby 1.9
You can convert an array into an enumerator like this: array = [1, 2, 3] enumerator = array.to_enum Then you can iterate through it like this: enumerator.next (returns 1) enumerator.next (returns 2) enumerator.rewind (resets the iteration) enumerator.next (returns 1) You can also iterate an enumerator and receive an index...
I recently had to install MySQL on a friend's MacBook and realized there was a small error in my article on this blog. I corrected the error and changed some parameters in the "gem install mysql" command!
I just removed some old Github repositories that were somehow related to this blog. But the repo's were outdated... Or became completely useless!