Vim editor for ruby on rails development using rails.vim

Vim install On CentOSyum install vim-enhancedVim install on Ubuntu machineInstall vim-full using commandapt-get install vimWhile coding with ruby, html, erb, haml, js and stylesheets.It is great pain to indent code. Using rails vim one can easilykeep code always indented.This increases code readability and minimizes effort, bugs andfinally proves ease of using vim editor.rails.vim script contains … Continue reading Vim editor for ruby on rails development using rails.vim

Bean Validation Framework

This framework implemented get rid of validate bean object using if-else condition and easy to integrate custom validators. - This is developed using Java 1.5 and no other library is required. - Used Generics,Reflection and Annotation in implementation. - Light weight Annotation base bean validation with runtime plugable custom validators.No need to register custom validator … Continue reading Bean Validation Framework

Extend enumerable to add method collect_with_index

module Enumerable def collect_with_index(i=0) collect{|elm| yield(elm, i+=1)} end alias map_with_index collect_with_indexend #Example use : ree-1.8.7-2010.01 > ['ruby', 'rails', 'sandip'].map_with_index{ |w,i| [w, i] } #=> [["ruby", 1], ["rails", 2], ["sandip", 3]] ree-1.8.7-2010.01 > ['ruby', 'rails', 'sandip'].collect_with_index{ |w,i| [w, i] } #=> [["ruby", 1], ["rails", 2], ["sandip", 3]] #By default index starts from zero to specify custom … Continue reading Extend enumerable to add method collect_with_index