Add .editorconfig

See http://editorconfig.org/.
Clean trailing whitespaces and blank lines, insert final newline
Fix mismatched indentation in ruby sources
Fix some formatting
Fix Gemfile and gemspec

It's unnecessary to repeat the same dependencies both in gemspec and
Gemfile.
Also simplify require of version.rb in gemspec
Merge pull request #1 from jirutka/patch-2

Some major formatting, code-style and other fixes