Easy attribute assignment (in Rails)
Update: It seems like I reinvented Hash#slice which is already in the Rails API
Written on Fri Mar 21 17:34:39 2008.
Tagged as rails, ruby.
Update: It seems like I reinvented Hash#slice which is already in the Rails API
Written on Fri Mar 21 17:34:39 2008.
Tagged as rails, ruby.
Method Chaining is an important technique to create beautiful code in object oriented languages, but Ruby (the beautiful language, right?) does not support it as well as it should.
Written on Sun Mar 16 10:17:59 2008.
Tagged as gem, ruby.
More specifically, Ruby doesn’t have real mixins (or interfaces or typeclasses if you like). But then what does a module mixin do? It modifies a class’s inheritance chain at runtime
Written on Tue Mar 11 18:26:54 2008.
Tagged as gem, ruby.
Must people love a new feature in Ruby called Symbol#to_proc, but there are not many good explanations of it. The concept is actually fairly straightforward, but the Ruby implementation is fairly complex. The following is an explanation that assumes no knowledge of Ruby.
Written on Mon Feb 25 20:04:26 2008.
Tagged as linux, ruby, script.
In the book Beautiful Code some code is more beautiful than other code. But there is little doubt that the opening chapter presents a regular expression matcher in a beautifully succinct fashion. As the author Brian Kernighan states: “I don’t know of another piece of code that does so much in so few lines while providing such a rich source of insight and further ideas.”
The example is written in C. I wondered if a more beautiful version could be created using a newer programming language. But we can maintatin the advantages of C and work at a slightly higher level by using lists. Since this code also uses recursion and pattern matching, Haskell is a very natural replacement.
Written on Mon Feb 4 20:00:22 2008.
Tagged as C, haskell, regex.
The script I use most frequently is a script for extracting files. If you work from the linux command line, it is impossible to remember which program with which flags should be used to extract a file. This is something the computer should do for you! This extraction script solves the problem, and you can configure the first lines of the script to match any filetype. I use it so often that I have it aliased to ‘e’
Written on Fri Feb 1 00:59:26 2008.
Tagged as linux, ruby, script.
Setting up my blog got me thinking: Do we really need so many blogging systems? To be specific, I am using an open source static blog generator. There are three different programs for this kind of blog written in the ruby programming language. Of course there are several open source dynamic ruby blogging systems. Venturing out of ruby, there are many blogging systems for all the other languages being used with web programming.
Written on Fri Jan 18 09:00:00 2008.
Tagged as blog, openSource, ruby, software.
I never thought I would be a blogger. It seemed so narcissitic to me, but I have come across a lot of useful information or cool ideas on people’s blogs. With that in mind, this blog will have a technical orientation since I know that nobody cares that I took a trip to the zoo yesterday. To prove it, here is the technical setup of my blog.