As you may know, Ruby’s official website sucks. Just compare with Haskell or Perl. As one of the maintainers, I am responsible for this situation to some extent. I made several attempts at triggering an update process in the past two years, though. It always failed due to lack of motivation and feedbacks. But now is the time for a change!
One little kink some people get to notice when coding in Ruby is this
#initialize inconsistency. In order to create an object, one calls a the
#new class method, but its implementation is (well, seems to be) provided under the
#initialize instance method. How come such a flaw has made its way into the language spec? Well, actually, there is no flaw in there, just a hidden hook.
Github Pages runs your
gh-pages content through
jekyll --pygments --safe. The
safe option prevents from loading any Ruby script, thus disabling all your lovely plugins :( There is no way to bypass this option, but here is a workaround.
Unsatisfied by Rails’ internal logger and the available alternatives (too light, too heavy…), I created my own little logging gem. Reinventing the wheel feels so good! It is called Logg and obviously it aims to be simple and efficient (as always). Actually, it can be used as anything but a logger… but logging is what I have been using it from the beginning, so I will stick with the name “Logg” anyway.
My main goal here was to create a versatile “method builder”. What is that? When it comes to logging, I may not need LOG_LEVELS flags, complex filters, actually I may not need anything but methods (!!) acting as little logging helpers. And when I need a specific feature will come the time to think about complex things such as registering plugins, mixins or gems. But down to the earth, what I do need all the time is as simple as being able to perform these two things:
- some dynamic formatting. I thus focused on this aspect, and leveraged Tilt.
- easy data-dispatching. I’m not talking about a protocol or anything, just the ability to yell something to whoever wants to know about it.
The first point is built-in: Logg supports templating. That’s it. The README gives several examples. To address the second point, I would recommend using a third-party library, such as AS::Notifications or Onfire. Logg just makes it easy to plug those things together, thanks to its block-everywhere interface and cheap DSL.
So here it is: a simple logging/dispatching/whatever library. Tell me if you happen to use it!
The Jellybeans colorscheme for vim is great, but its implementation is a little bit contrived when compared to other colorschemes files. It features a complex support for greyscale and RGB approximations: it will do its best to guess some smart RGB values based on your terminal “depth” (for instance, you may have support for 24, 88 or even 256 colors in your rxvt shell). The hexa color codes provided in this colorscheme may thus not be exactly those you’ll actually be using (or may fetch using tools such as gcolor2).
Therefore, if you use vim in the terminal (ie. not gvim), you may be puzzled by the fact this colorscheme enforces a background color… yet seems to be unaware of its hexa code. To change the color or to get rid of it so as to fallback on your terminal’s background color, edit lines #308 and #309 of
By setting the
BackgroundColor to an empty value, one can fully integrate vim into the terminal profile.
Note that the
set background=dark is only a hint for vim integration algorithm, merely stating that the background of the colorscheme is of the dark side.
Several other color schemes make use of the color approximation functions; for instance, desert256, wombat256 or mrkn256. Feel then free to test them if you’re using a 256 colors terminal.
Recursion is a powerful computation pattern, mostly found in functionnal languages. Imperative languages such as Ruby may make use of recursive algorithms, though: it actually makes sense to use them with blocks. Let’s see an example.