Skip to content

Instantly share code, notes, and snippets.

<!-- SOCIAL SHARING SNIPPET
make sure you include the socialsnippet.js, get-involved.css, and socialsnippet.css
-->
<script type="text/javascript" src="http://propublica.s3.amazonaws.com/assets/social/socialsnippet.js"></script>
<link rel="stylesheet" href="http://propublica.s3.amazonaws.com/assets/social/socialsnippet.css">
<div class="social_section">
propublica.views.nameTypeaheadWidget = propublica.View.extend({
tag : "input",
cssClass : "name_typeaheadwidget",
bindings : {
"selected" : "matchNameWidget"
},
render : function() {
var congress_names = ["Aaron Schock","Adam B. Schiff","William Cowan","Adam Kinzinger","Adam Smith","Adrian Smith","Al Franken","Al Green","Alan Grayson","Alan Lowenthal","Alan Nunnelee","Albio Sires","Alcee L. Hastings","Allyson Y. Schwartz","Ami Bera","Amy Klobuchar","Ander Crenshaw","Andre Carson","Andy Barr","Andy Harris","Angus King","Ann Kirkpatrick","Ann McLane Kuster","Ann Wagner","Anna G. Eshoo","Austin Scott","Barack Obama","Barbara A. Mikulski","Barbara Boxer","Barbara Lee","Ben Ray Lujan","Benjamin L. Cardin","Bennie Thompson","Bernard Sanders","Beto O'Rourke","Betty McCollum","Bill Cassidy","Bill Flores","Bill Foster","Bill Huizenga","Bill Johnson","Bill Keating","Bill Nelson","Bill Owens","Bill Pascrell","Bill Posey","Bill Shuster","Bill Young","Billy Long","Blaine Luetkemeyer","Blake Farent
propublica.views.nameTypeahead = propublica.View.extend({
tag : "input",
cssClass : "name_typeahead",
bindings : {
"selected" : "matchNameMain"
},
render : function() {
var congress_names = ["Aaron Schock","Adam B. Schiff","Adam Kinzinger","Adam Smith","Adrian Smith","Al Franken","Al Green","Alan Grayson","Alan Lowenthal","Alan Nunnelee","Albio Sires","Alcee L. Hastings","Allyson Y. Schwartz","Ami Bera","Amy Klobuchar","Ander Crenshaw","Andre Carson","Andy Barr","Andy Harris","Angus King","Ann Kirkpatrick","Ann McLane Kuster","Ann Wagner","Anna G. Eshoo","Austin Scott","Barack Obama","Barbara A. Mikulski","Barbara Boxer","Barbara Lee","Ben Ray Lujan","Benjamin L. Cardin","Bennie Thompson","Bernard Sanders","Beto O'Rourke","Betty McCollum","Bill Cassidy","Bill Flores","Bill Foster","Bill Huizenga","Bill Johnson","Bill Keating","Bill Nelson","Bill Owens","Bill Pascrell","Bill Posey","Bill Shuster","Bill Young","Billy Long","Blaine Luetkemeyer","Blake Farenthold","Bob Casey","Bob Corker"
@lenagroeger
lenagroeger / citiesgeocode
Created June 18, 2014 17:20
geocode some cities
# task :bundlegeocode => :environment do
# require 'goog_geocoder'
# factory = ::RGeo::Geographic.simple_mercator_factory()
# f = CSV.open("#{Rails.root.to_s}/db/initial/bundlecities.csv", :headers => true)
# f.each do |row|
# city = row["city"]
# state = row["state"]
# goog = GoogGeocoder.new("#{city},#{state}")
# if !goog.resp["results"].empty?
# accuracy = goog.resp["results"].first["geometry"]["location_type"]
REGIONS = {"NORTHEAST" => ["CONNECTICUT"," MAINE"," MASSACHUSETTS"," NEW HAMPSHIRE"," RHODE ISLAND"," VERMONT"," NEW JERSEY"," NEW YORK"," PENNSYLVANIA"],
"MIDWEST" => ["ILLINOIS"," INDIANA"," MICHIGAN"," OHIO"," WISCONSIN"," IOWA"," KANSAS"," MINNESOTA"," MISSOURI"," NEBRASKA"," NORTH DAKOTA"," SOUTH DAKOTA"],
"SOUTH" => ["DELAWARE"," FLORIDA"," GEORGIA"," MARYLAND"," NORTH CAROLINA"," SOUTH CAROLINA"," VIRGINIA"," WASHINGTON D.C."," WEST VIRGINIA"," ALABAMA"," KENTUCKY"," MISSISSIPPI"," TENNESSEE"," ARKANSAS"," LOUISIANA"," OKLAHOMA"," TEXAS"],
"WEST" => ["ARIZONA"," COLORADO"," IDAHO"," MONTANA"," NEVADA"," NEW MEXICO"," UTAH"," WYOMING"," ALASKA"," CALIFORNIA"," HAWAII"," OREGON"," WASHINGTON"]}
//////// THE MODEL, making GunsMap and defining the function getColors();////////
propublica.models.GunsMap = propublica.Model.extend({
getColors : function() {
var arr = ["H001064","D000191","L000573","A000369","K000382","M000133","L000559","S000522","C000714","Y000033","H001050"]
$(".carto .tiny_size .color_overlay").each(function() {
var bioid = $(this).parents(".member_box").attr("data-id");
if (arr.indexOf(bioid) > -1) {
propublica.views.FrackMap = propublica.View.extend({
id : "frack",
render : function() {
var frackdata = {
"LA":[14986, 37499, 400594, 1242678, 2088306, 2130551, "Louisiana"],
"NM":[54020, 57462, 60590, 71867, 93071, 127548 , "New Mexico"],
"OK":[83015, 204474, 327805, 406143, 449167, 503329, "Oklahoma"],
var tooltip = $("#tooltip");
tooltip.hide()
var bar = $(".bar");
bar.hover(function(e) {
tooltip.show()
$(this).addClass("active");
var text = $(this).html();
tooltip.html(text);
require 'rubygems'
require 'restclient'
require 'nokogiri'
require 'logger'
require 'net/http'
require 'mechanize'
# page_num = 2
# item_num = 2
SEARCH_URL = "http://cgmix.uscg.mil/IIR/IIRSearch.aspx"
@lenagroeger
lenagroeger / socialsnip
Created April 16, 2014 17:58
social sharing snippet
<!-- SOCIAL SHARING SNIPPET
make sure you include the socialsnippet.js, get-involved.css, and socialsnippet.css
-->
<script type="text/javascript" src="http://propublica.s3.amazonaws.com/assets/social/socialsnippet.js"></script>
<link rel="stylesheet" href="http://propublica.s3.amazonaws.com/assets/social/socialsnippet.css">
<div class="social_section">