Skip to content

Instantly share code, notes, and snippets.

@izniburak
Created November 21, 2017 07:47
Show Gist options
  • Save izniburak/6c45943daf22e69fb456b465409abed6 to your computer and use it in GitHub Desktop.
Save izniburak/6c45943daf22e69fb456b465409abed6 to your computer and use it in GitHub Desktop.
habersistemim kitap hediye çekilişi için yazdığım ufak script
require 'rubyXL'
require 'terminal-table'
person = 2
extra = true
file_ruby = RubyXL::Parser.parse 'liste-ruby.xlsx'
file_go = RubyXL::Parser.parse 'liste-go.xlsx'
list_ruby = file_ruby.first.to_a.shuffle
list_go = file_go.first.to_a.shuffle
rows_ruby, rows_go = [], []
count = extra.eql?(true) ? person*2 : person
(0...count).each do |index|
row = list_ruby[index]
time, name, email, twitter, option = row.cells.map(&:value)
rows_ruby.push [index+1, name, twitter, option]
row = list_go[index]
time, name, email, twitter, option = row.cells.map(&:value)
rows_go.push [index+1, name, twitter, option]
end
title = %q(
_ _ _ _ _
| | | | (_) | | (_)
| |__ __ _| |__ ___ _ __ ___ _ ___| |_ ___ _ __ ___ _ _ __ ___
| '_ \ / _` | '_ \ / _ \ '__/ __| / __| __/ _ \ '_ ` _ \| | '_ ` _ \
| | | | (_| | |_) | __/ | \__ \ \__ \ || __/ | | | | | | | | | | |
|_| |_|\__,_|_.__/ \___|_| |___/_|___/\__\___|_| |_| |_|_|_| |_| |_|
)
puts title
rows_ruby.push [" ", " ", " ", " "]
rows = rows_ruby + rows_go
table = Terminal::Table.new headings: ['#', 'Ad Soyad', 'Twitter', 'İstek'], rows: rows
puts table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment