This file contains 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 'rubygems' | |
require 'fastercsv' | |
data = [] | |
html = <<-HTML | |
HTML | |
FasterCSV.foreach("fda.csv", :headers => true) do |row| | |
data << row |
This file contains 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
<script id="drone-templ" type="text/jst"> | |
<div id="drones-source">According to: <%=source%></div> | |
<div id="drones-claim"><%=claim%></div> | |
<div id="drones-outlet">– <%=outlet%></div> | |
</script> | |
<script type="text/javascript"> | |
$(document).ready(function() { |
This file contains 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
var stateNames = { | |
"AL":"Alabama", | |
"AK":"Alaska", | |
"AZ":"Arizona", | |
"AR":"Arkansas", | |
"CA":"California", | |
"CO":"Colorado", | |
"CT":"Connecticut", | |
"DE":"Delaware", | |
"DC":"District of Columbia", |
This file contains 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
data.each do |row| | |
el=<<-HTML | |
<div class="drones-bar" style="width:#{(row["duration"].to_f/5)}px; margin-left: #{(row["days_from_start"].to_f/5)}px;" data-id="#{row["number"]}"><p class="deaths"><a href="#{row["link"]}">"#{row["deaths"]}"</a></p></div> | |
HTML | |
html << el | |
end |
This file contains 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
def fmt_stat(stat, prefix = "$") | |
stat = case stat | |
when -999999999999..-10000 then number_to_human(stat, :units => {:million => "M", :thousand => "K", :billion => "B"}).gsub(/ /,'') | |
when -9999..9999 then number_with_delimiter(stat) | |
when 10000..999999999999 then number_to_human(stat, :units => {:million => "M", :thousand => "K", :billion => "B"}).gsub(/ /,'') | |
when nil then number_with_delimiter(0) | |
else stat | |
end | |
stat = stat === "N/A" ? stat : "#{prefix}#{stat}" | |
end |
This file contains 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
sed -i '' -e's/\*\*NOTE-\ TERMS\ IN\ BRACKETS\ HAVE\ BEEN\ EDITED\ TO\ PROTECT\ CONFIDENTIALITY\*\*/ /g' regionALL.csv |
This file contains 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
cat reg1.csv reg2.csv reg3.csv reg4.csv reg5.csv reg6.csv reg7.csv reg8.csv reg9.csv reg10.csv > regionALL.csv |
This file contains 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
CSS: | |
.blurb { | |
width:200px; | |
height:60px; | |
background:#444; | |
color:white; | |
display:none; | |
} | |
HTML: |
This file contains 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
def fmt_stat(stat, prefix = stat > 0 ? "$" : "") | |
stat = case stat | |
when -999999999999..-10000 then number_to_human(stat, :units => {:million => "M", :thousand => "K", :billion => "B"}).gsub(/ /,'') | |
when -9999..-1 then number_with_delimiter(stat) | |
when 0 then "<em>No Data.</em>" | |
when 1..9999 then number_with_delimiter(stat) | |
when 10000..999999999999 then number_to_human(stat, :units => {:million => "M", :thousand => "K", :billion => "B"}).gsub(/ /,'') | |
when nil then number_with_delimiter(0) | |
else stat | |
end |
This file contains 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
<link rel="stylesheet" href="http://propublica.org/static/stateface/stateface.css" type="text/css" charset="utf-8" /> | |
STATEFACE = { | |
"USA" => "z", | |
"AL" => "B", | |
"AK" => "A", | |
"AZ" => "D", | |
"AR" => "C", | |
"CA" => "E", |
OlderNewer