Skip to content

Instantly share code, notes, and snippets.

@ellery
Created November 5, 2016 20:06
Show Gist options
  • Save ellery/abd0a8bf79148f6fd2adfddf04658d22 to your computer and use it in GitHub Desktop.
Save ellery/abd0a8bf79148f6fd2adfddf04658d22 to your computer and use it in GitHub Desktop.
csv_data =
'1235550695,2016-08-30 15:52:20
2345555220,2016-10-20 09:04:59
2345555220,2016-10-20 11:32:58
3455550667,2016-10-15 18:02:03
3455550667,2016-10-15 18:06:45
3455550667,2016-10-21 23:08:32
3455550667,2016-10-21 23:11:24
'
call_array = CSV.parse(csv_data)
call_array.each do |call|
call.push(DateTime.parse(call[1]).strftime('%s').to_i)
end
call_array.sort_by!{ |p| p[2] }.reverse.uniq { |p| p[0] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment