Joined June 2011
·

Nihad Abbasov

·

@andoriyu 99, 400 people can't be wrong.

Posted to Rails Quick Tips - Random Records over 1 year ago
ids = User.ids.sample(5)
User.find ids

There is still a plenty of room for the improvement.

Posted to Working with Unicode in Ruby over 1 year ago

Default in Ruby 2.0

What if you want to do page/action caching?

Use GraphicsMagick. It's supported by mini_magick.

Posted to Real time in Rails over 1 year ago

Use Time.current

Posted to therubyracer and libv8 gem on centos5 over 1 year ago

Latest version of therubyracer doesn't require libv8.

jQuery find() convention has bad performance

For DOM queries use Cascading $('#foo a') or parent > child $('#foo > a').

// bad
$('#foo', 'a').hide();

// bad
$('#foo').find('a').hide();

// good
$('#foo a').hide();

// good
$('#foo > a').hide();
Posted to Quickly increment/decrement over 1 year ago

42<Ctrl-A> to increment by forty-two

Bad tip. Doesn't work for all cases. Rails has SecurePassword module.

Achievements
202 Karma
1,952 Total ProTip Views