Skip to content

Instantly share code, notes, and snippets.

View dwillis's full-sized avatar

Derek Willis dwillis

View GitHub Profile
def self.load_from_csv
columns = column_names.reject{|c| ["created_at", "updated_at", "id"].include?(c)}
values = []
FasterCSV.foreach("#{Rails.root}/db/data/my_file.csv", :headers => true) do |row|
values << row
end
import(columns, values, :validate => false, :on_duplicate_key_update => [:field_one, :field_two])
end
["mitt romney", "mitt romney for president", "mitt romney presidential campaign", "romney", "massachussets mitt romney", "republican mitt romney", "mitt romney iowa", "mitt romney iowa speech", "mitt romney campaign", "mitt romney gop primary", "mitt romney for president", "mitt romney news", "election 2012", "Newt gingrich", "newt", "gingrich", "newt gingrich gop", "newt gingrich 2012 election", "newt gingrich speaker", "newt gingrich republican", "who is newt gingrich", "newt gingrich campaign", "newt gingrich bio", "newt gingrich presidential candidate", "gingrich poll", "newt gingrich iowa poll", "gingrich south carolina poll", "gingrich gop primary", "newt gingrich news", "newt gingrich election 2012", "newt gingrich 2012 campaign", "election 2012", "Rick santorum", "rick santorum news", "rick santorum president", "rick santorum 2012", "rick santorum republican", "rick santorum senator", "senator rick santorum", "rick santorum gop", "2012 election", "2012 election news", "2012 candidates", "presidential
Purpose Amount
SALARY 171,765.47
TRAVEL-NO ITEM. REQUIRED 147,966.40
TELEMARKETING 115,365.11
DATA MANAGEMENT 65,153.94
EVENT PRODUCTION 63,561.73
GRASSROOTS CONSULTING/TRAVEL 42,909.89
STRATEGIC CONSULTING 39,014.29
LEGAL FEES 37,975.65
TRAVEL 36,787.82
the Committee is also concerned that Congress maintains the ability to ensure that its legislative data files remain intact and a trusted source once they are removed from the Government's domain to private sites.
[{"DEM"=>"Democratic"}, {"DFL"=>"Democratic"}, {"REP"=>"Republican"}, {"AKI"=>"Alaskan Independence"}, {"ACP"=>"American Constitution"}, {"AIP"=>"American Independent Party"}, {"CIT"=>"Citizens"}, {"CON"=>"Conservative"}, {"CST"=>"Constitution"}, {"GRE"=>"Green"}, {"LIB"=>"Libertarian"}, {"MTN"=>"Mountain"}, {"PFP"=>"Peace and Freedom"}, {"PRG"=>"Progressive"}, {"REF"=>"Reform"}, {"SOC"=>"Socialist"}, {"SWP"=>"Socialist Workers"}, {"IAP"=>"Independent American Party"}, {"IDP"=>"Independence Party"}, {"TEA"=>"Tea Party"}, {"MOD"=>"Moderate"}, {"TX"=>"U.S. Taxpayers"}, {"IND"=>"Independent"}, {"NPA"=>"Independent"}, {"WF"=>"Working Families"}, {"FEP"=>"Free Energy Party"}, {"WW"=>"World Workers"}, {"GRP"=>"Grassroots Party"}, {"Pro"=>"Prohibition"}, {"NLP"=>"Natural Law"}, {"OTH"=>"Other"}, {"FED"=>"Federalist"}, {"WRI"=>"Write-In"}, {"NPP"=>"Independent"}, {"NNE"=>"None"}, {"UNK"=>"Unknown"}, {"SEP"=>"Socialist Equality"}, {"CF"=>"Christian Freedom"}, {"CnP"=>"Concerns of People"}, {"PCH"=>"Personal Choice"},
cycle state year month amount
2006 MN 2006 8 315470.64
2010 MN 2010 5 309384.39
2010 MN 2010 3 182730.13
2010 MN 2010 8 174111.74
2010 MN 2010 9 170421.42
2006 MN 2006 10 169362.40
2010 MN 2010 10 161885.87
2008 MN 2008 10 140571.43
2010 MN 2010 4 131456.53
class Game(models.Model):
season = models.IntegerField()
team1 = models.ForeignKey(CollegeYear, related_name='team1')
coach1 = models.ForeignKey(Coach, null=True, related_name='first_coach')
team2 = models.ForeignKey(CollegeYear, related_name='team2')
coach2 = models.ForeignKey(Coach, null=True, related_name='second_coach')
Committee Date Amount
RESTORE OUR FUTURE, INC. 7/20/2012 2,000,000.00
American Crossroads 6/28/2012 2,000,000.00
TEXAS CONSERVATIVES FUND 6/15/2012 100,000.00
RESTORE OUR FUTURE, INC. 6/1/2012 2,000,000.00
TEXAS CONSERVATIVES FUND 5/23/2012 100,000.00
TEXAS CONSERVATIVES FUND 4/30/2012 100,000.00
Congressional Leadership Fund 4/23/2012 1,000,000.00
RESTORE OUR FUTURE, INC. 4/18/2012 -750,000.00
RESTORE OUR FUTURE, INC. 4/5/2012 750,000.00
Committee Date Amount
Independence Virginia PAC 9/14/2012 250,000.00
Independence Virginia PAC 9/5/2012 250,000.00
Independence Virginia PAC 8/22/2012 250,000.00
American Crossroads 8/21/2012 2,000,000.00
Independence Virginia PAC 7/26/2012 250,000.00
RESTORE OUR FUTURE, INC. 7/20/2012 2,000,000.00
American Crossroads 6/28/2012 2,000,000.00
TEXAS CONSERVATIVES FUND 6/15/2012 100,000.00
RESTORE OUR FUTURE, INC. 6/1/2012 2,000,000.00
Committee Date Amount
FREEDOM PAC 2012-10-12 1,000,000.0
TREASURE COAST JOBS COALITION 2012-10-12 250,000.0
Independence Virginia PAC 2012-10-12 1,500,000.0
Patriot Prosperity Political Action Committee 2012-10-12 250,000.0
TREASURE COAST JOBS COALITION 2012-10-11 250,000.0
RESTORE OUR FUTURE, INC. 2012-10-11 5,000,000.0
Ending Spending Action Fund 2012-10-11 500,000.0
Hispanic Leadership Fund Action 2012-10-05 190,000.0
TEXAS CONSERVATIVES FUND 2012-07-27 250,000.0