Archives for posts tagged ‘code’

Rails on the Run: Avoid using metaprogramming (seriously!)

Avoid using metaprogramming (seriously!) at Rails on the Run.
As the pragmatic programmers would have put it: write code to be clear, not clever. Especially when the clearer variant even outperforms the clever one.

My first bookmarklet

After quite some time I write one of these things that were supposed to be the overall topic of this blog: a snippet. This time, it’s a bookmarklet. My first bookmarklet at all. So without further ado, here’s what it takes to immediately jump from an O’Reilly catalog page to the corresponding search page at [...]

Two Is An Impossible Number

Yesterday I had to add a third case to a piece of code that is currently capable of handling two cases and that seems like the original author didn’t ever want to enable adding any other cases. This is not the first time that I have to do something like that and I remember being [...]

FLOSS Weekly #27: Ward Cunningham

FLOSS Weekly 27: Ward Cunningham is, in my opinion, the best episode of FLOSS Weekly so far. Which I can say without guessing, because I listend to them all.
Part of my excitement is probably the fact that the things that Ward Cunningham has contributed are what I am pursuing to propagate at may dayjob right [...]

Shuffle and conquer

A few weeks ago I joined Goodreads. A few days ago I installed a wordpress plugin that displays three of the books on my ‘currentl reading’ shelf. This plugin uses the RSS features delivered with wordpress. It fetches the feed belonging to the shelf, grabs the first three items and displays them in my sidebar.
I [...]

Programming Ruby: Chapter 7

if can be used to build expressions, so you can use it for conditional assignments.
variable =
  if condition
    if_value
  else
    else_value
Even using operators is basically calling methods. So 3 * 2 + 1 can be [...]

Programming Ruby: Chapter 6

Names of boolean methods are usually suffixed with a question mark.
Names of methods used to set values are usually suffixed with an equals sign.
Within a method body you can determine whether a block was passed by calling, guess what, block_given?.

Programming Ruby: Chapter 4

A block passed to a method after the regular parameter list can be invoked by saying yield.

 

Programming Ruby: Chapter 3

20 chapters of Python should be a foundation solid enough to let me start learning yet another language without mixing the new knowledge up. Well, at least I am gonna give it a try. So here’s what I found out while reading Programming Ruby.

When overriding a method in a subclass, the keyword super suffices on [...]

Learning Python: Chapter 20

Package imports require you to put __init__.py files in each directory in the package chain.
The modifier as provides a means of neatly aliasing package paths in import statements with short names.