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
// Reusable extension for jQuery so that we can hide jQuery objects | |
// and hide them. We will show an arrow at the top-right corner which | |
// will toggle the display of these. | |
// Examples: | |
// | |
// For github.com.js: | |
// $("#header").toggleStuff(); | |
// | |
// Some random site: | |
// $("#report_attachment").parent().next().toggleStuff() |
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
/* Get querystring parameter's value */ | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
var regex = new RegExp(regexS); | |
var results = regex.exec(window.location.search); | |
if(results == null) | |
return null; | |
else | |
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
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
# bin/get_directions.py gets us with_directions.csv | |
# This can be easily loaded into SQLite: | |
> create table trips (vendor, 'pickupTime' DATETIME, duration, terminal, direction); | |
> .mode csv | |
> .import with_directions.csv trips | |
# To get daily counts from the SQL | |
> select DATE(pickupTime), count(1) from trips group by DATE(pickupTime) |
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
map = L.map('map', {zoomControl: false}); | |
map.fitBounds([[40.869693, -74.170267], [40.546460, -73.772013]]); | |
var MAP_ROOT = 'http://{s}.tiles.mapbox.com/v4/MAP_ID' | |
, TOKEN = 'Access token from Mapbox'; | |
L.tileLayer(MAP_ROOT + '/{z}/{x}/{y}.png?access_token=' + TOKEN, { | |
attribution: 'Attribution text and links', | |
maxZoom: 18, |
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 transform, d3path; | |
function initSVG() { | |
transform = d3.geo.transform({ point: projectPoint }); | |
d3path = d3.geo.path().projection(transform); | |
} | |
// We do the following for each feature | |
feature.geometry.coordinates = polyline.decode( | |
feature.geometry.coordinates); |
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 dataCache = {}; | |
function getData (query) { | |
var key = query.startDate; | |
if ( !(key in dataCache) ) { | |
dataCache[key] = $.getJSON('/trip?', query); | |
} | |
} | |
function getNextChunk (params) { |
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
(function ($) { | |
function updateCharCount($obj, text, max_char) { | |
var contentLength = text.length; | |
$obj.find('.char-count').text(contentLength); | |
if (contentLength > max_char) { | |
$obj.removeClass('text-navy').addClass('text-danger'); | |
} else { | |
$obj.removeClass('text-danger').addClass('text-navy'); | |
} |
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 process_cell(cell): | |
if cell.is_date and cell.value: | |
return cell.value.strftime('%m/%d/%Y') | |
elif '"$"#' in cell.number_format: | |
if isinstance(cell.value, float) or isinstance(cell.value, int): | |
return '${:,.2f}'.format(cell.value) | |
return cell.value | |
def process_claims(sheet): |