This demonstrates the math used to create the "seating chart"-style shapes on our House Outlook page.
This file contains hidden or 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
| require 'fech' | |
| require 'json' | |
| module Fech | |
| class Filing | |
| def to_json | |
| rows_like(//).to_json | |
| end | |
| end | |
| end |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <title>Testing Pie Chart</title> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |
This file contains hidden or 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
| require 'open-uri' | |
| require 'nokogiri' | |
| class PublicFileCrawler | |
| def initialize(params={}) | |
| @call_sign = params[:call_sign] | |
| @url = "https://stations.fcc.gov/station-profile/#{@call_sign}/political-files/browse-%3e2012" | |
| @checked = {} | |
| @found = {} |
This file contains hidden or 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
| Copyright (c) 2016 Aaron Bycoffe | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
This file contains hidden or 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
| require 'fech' | |
| search = Fech::Search.new(date: Date.today, form_type: 'F6') | |
| search.results.sort_by { |x| -x.filing_id.to_i }.each do |result| | |
| filing = Fech::Filing.new(result.filing_id, :csv_parser => Fech::CsvDoctor) | |
| filing.download unless File.exists? filing.file_path | |
| filing.rows_like(/f65/) do |row| | |
| p [filing.filing_id, | |
| filing.summary.committee_name, | |
| row.contributor_last_name, |
This file contains hidden or 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
| {:rec_type=>"TEXT", :filer_committee_id_number=>"SA11ai", :back_reference_tran_id_number=>nil, :text=>"Regarding negative receipts listed on line 11(a)(i) with the description of 'ACH Return', these are interbank clearing of electronic payments processed by the Automated Clearing House (ACH) network of participating banks and the Federal Reserve. These are returns of contributions by individuals which have been deducted from our credit card merchant account or bank account by the credit card company or bank."} |
This file contains hidden or 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
| ["TEXT", "SA11ai", nil, "Regarding negative receipts listed on line 11(a)(i) with the description of 'ACH Return', these are interbank clearing of electronic payments processed by the Automated Clearing House (ACH) network of participating banks and the Federal Reserve. These are returns of contributions by individuals which have been deducted from our credit card merchant account or bank account by the credit card company or bank."] | |
| ["TEXT", "SA15", nil, "\"Regarding 'Asset Sales' reported on Schedule A supporting Line 15 of our report", " occasionally the RNC has used office equipment that we need to dispose of. This equipment may be sold in bulk to a commercial liquidation business or piece by piece to individuals. When this is done", " these items are reported as 'asset sale' and the price charged is such that they in no way constitute a political contribution. The used assets liquidated by sale to individuals or business are reported as 'Asset Sale' and are priced at fair market value. These items s |
This file contains hidden or 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
| original = Fech::Filing.new(764200) | |
| original.download | |
| amendment = Fech::Filing.new(764828) | |
| amendment.download | |
| comparison = Fech::Comparison.new(amendment, original) | |
| p comparison.summary | |
| # {:date_signed=>"20120207"} |
This file contains hidden or 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
| filing = Fech::Filing.new(766953) | |
| filing.download | |
| fields = [:contributor_first_name, | |
| :contributor_last_name, | |
| :contributor_organization_name, | |
| :contribution_amount] | |
| rows = filing.rows_like(/sa/, :include => fields) |