Skip to content

Instantly share code, notes, and snippets.

@jottr

jottr/console.md Secret

Last active March 24, 2016 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jottr/eddfd42e4e66562fa44c to your computer and use it in GitHub Desktop.
Save jottr/eddfd42e4e66562fa44c to your computer and use it in GitHub Desktop.
$ found.count
=> 2071
$ table.count
=> 26504
TypeError: no implicit conversion of String into Integer
from lib/scripts/sterntv_nl.rb:13:in `[]'
require 'csv'
recipients = CSV.read('recipients.csv', headers: true)
found = []
if User.find_by(email: recipients['email'])
found << recipients['email']
end
table = CSV.table('recipients.csv')
table.delete_if do |t|
found.each { |f| t['email'] == f['email']}
end
#found.each do |f|
#table.delete_if do |row|
#row['email'] == f['email']
#end
#end
CSV.open('/tmp/users.csv', 'wb') do |w|
w << found.to_csv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment