Call class method via instance in Ruby

This was posted 6 months ago. ruby

Codility sample demo test

I have taken Codility sample demo test at last. I was delaying this memorable moment for a few months, probably for fear that it could somehow turn out Im not that good as I think I am, which is surely the case for most developers. So I did the test and I’m going to take more tests there as it’s quite good fun. And here are my solutions for sample demo test below, both in PHP and Ruby.

This was posted 7 months ago. php ruby codility

Devise: find by username OR e-mail

This was posted 8 months ago. ruby devise rails

Regexp: string followed by and preceded by

Regular expressions are full of features (who can learn it all? or read off and understand a few days after it was written?). One of them is possibility to check if desired match is followed or preceded by given pattern.

It works also in PHP.

This was posted 11 months ago. regexp ruby php

Slow loading Rails environment

If you find it annoying that Rails environment, console or tasks takes far too much time, check out snailgun. Snailgun accelerates the startup of Ruby applications by preparing a Ruby process preloaded, and then forking that process whenever a new command-line Ruby interpreter is required. Makes development significantly faster and it can be even used for running tasks in production.

This was posted 1 year ago. ruby rails

Readable MySQL-like output in rails console or irb

Ever wanted to make irb or rails console output a little more clear and readable? At least something like from mysql console?

You should try hirb for nice output and wirble for nice colouring.

And that’s it. Enjoy it. It made my day the other day.

This was posted 1 year ago. rails ruby irb