Created
May 28, 2012 06:32
-
-
Save MaximeD/2817697 to your computer and use it in GitHub Desktop.
vim / emacs length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
vim = [ | |
"Ma configuration Vi / Vim / gVim - theClimber", | |
"Chapitre 16. Vim : un éditeur de texte", | |
"Ultimate Vim Config | Steve Francia's Epic Blog", | |
"Vim - Configuration complete (Page 1) / Logiciels éducatifs ...", | |
"vim - Documentation Ubuntu Francophone", | |
"The ultimate Vim configuration - vimrc", | |
"Une configuration de Vim aux petits oignons ! | Jonathan Petitcolas", | |
"outils:vim:configuration [CLI Wiki]" | |
] | |
emacs = [ | |
"Votre premier .emacs : la configuration d'Emacs pour les zéros", | |
"Configuration d'Emacs", | |
"Simple Emacs Configuration", | |
"Votre config emacs - Forum des professionnels en informatique", | |
"configuration - Suggested initial Emacs config? - Stack Overflow", | |
"Configurations - Ma configuration emacs", | |
"emacs - Documentation Ubuntu Francophone" | |
] | |
vim_char_length = vim.join.length | |
emacs_char_length = emacs.join.length | |
puts "vim : #{vim_char_length} caractères" | |
puts "emacs : #{emacs_char_length} caractères" | |
char_diff = vim_char_length - emacs_char_length | |
char_diff_abs = char_diff.abs | |
char_diff_rel = ( char_diff.abs.to_f / ((vim_char_length + emacs_char_length) / 2) ) * 100 | |
char_diff_rel = char_diff_rel.to_s[0,5] | |
puts "Soit une différence de #{char_diff_abs} charactères (#{char_diff_rel}%)" | |
puts | |
# will do the same on words, | |
# too lazy to write a class | |
vim_words = vim.join.split.length | |
emacs_words = emacs.join.split.length | |
puts "vim : #{vim_words}" | |
puts "emacs : #{emacs_words}" | |
words_diff = vim_words - emacs_words | |
words_diff_abs = words_diff.abs | |
words_diff_rel = ( words_diff.abs.to_f / ((vim_words + emacs_words) / 2) ) * 100 | |
words_diff_rel = words_diff_rel.to_s[0,5] | |
puts "Soit une différence de #{words_diff_abs} charactères (#{words_diff_rel}%)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment