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 fixDate(fieldname,datestr) { | |
//Make lowercase | |
newdatestr = datestr.toLowerCase(); | |
//trim first | |
newdatestr = newdatestr.replace(/^\s+|\s+$/g,''); | |
//If it was just whitespace, don't run the function | |
if (!newdatestr.length) { | |
return; | |
} |
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
//Return a cached selection if it's been used, | |
//Otherwise get the jQuery selection and cache it | |
var $$ = function(x) { | |
if (!this[x]) this[x] = $(x); | |
return this[x]; | |
} | |
$$("div.test").html("a"); | |
$$("div.test").html("b"); |
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
ciphered = [ | |
{ | |
"offset": 11, | |
"text": "HAPCV ITGBH UDG JCXITS HIPITH RJGGTCRN" | |
}, | |
{ | |
"offset": 9, | |
"text": "UVRU DLJZTZREJ" | |
}, | |
{ |
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
//Return a cached selection if it's been used, | |
//Otherwise get the jQuery selection and cache it | |
var $$ = function(x) { | |
if (!this[x]) this[x] = $(x); | |
return this[x]; | |
}; | |
//Use $ where the selection results might change between selections | |
$("div.whatever").show(); //Get a new selection | |
$("div.whatever").hide(); //Get a new selection |
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
[Desktop Entry] | |
Version=1.0 | |
Name=Sublime Text 2 | |
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings. | |
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413. | |
GenericName=Text Editor | |
Exec=sublime | |
Terminal=false | |
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png |
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 arrows = d3.selectAll(".g-chart--reported svg").append("g").attr("class","arrows").selectAll("rect").data(d3.range(12)).enter().append("rect"),bars = d3.selectAll(".g-chart--reported svg rect.g-bar"),scale = d3.scale.linear().range([80,10]),newData = bars.data().map(function(d,i){ return d; }); arrows.attr("x",function(d,i){ return +bars.filter(function(f,j){ return j == i; }).attr("x")+3; }).attr("width",function(d,i){ return +bars.filter(function(f,j){ return j == i; }).attr("width")-6; }); setInterval(function(){newData = bars.data().map(function(d,i){ return d; }); newData = newData.map(function(d,i){ return i % 12 ? d.reported - newData[i-1].reported : null;}); scale.domain(d3.extent(newData.filter(function(d){return d !== null;}))); arrows.data(newData).style("fill",function(d){ return d < 0 ? "firebrick" : "steelblue"; }).attr("y",function(d){ return d < 0 ? scale(0) : scale(d); }).attr("height",function(d){ return d < 0 ? scale(d) - scale(0) : scale(0) - scale(d); })},200); |
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
d3.range(2).forEach(function(chartIndex){ var chart = d3.selectAll(".g-chart--reported svg").filter(function(d,i){return i == chartIndex;}); var arrows = chart.append("g").attr("class","arrows").selectAll("rect").data(d3.range(12)).enter().append("rect"),bars = chart.selectAll("rect.g-bar"),scale = d3.scale.linear().range([80,10]),newData = bars.data().map(function(d,i){ return d; }); arrows.attr("x",function(d,i){ return +bars.filter(function(f,j){ return j == i; }).attr("x")+3; }).attr("width",function(d,i){ return +bars.filter(function(f,j){ return j == i; }).attr("width")-6; }); setInterval(function(){ newData = bars.data().map(function(d,i){ return d; }); newData = newData.map(function(d,i){ return i ? d.reported - newData[i-1].reported : i;}); scale.domain(d3.extent(newData)); arrows.data(newData).style("fill",function(d){ return d < 0 ? "firebrick" : "steelblue"; }).attr("y",function(d,i){ return d < 0 ? scale(0) : scale(d); }).attr("height",function(d){ return d < 0 ? scale(d) - scale(0) : scale(0) - |
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
queue() | |
.defer(getJSON,"new-york.json") | |
.defer(getJSON,"chicago.json") | |
.defer(getJSON,"miami.json") | |
.awaitAll(function(error,cities) { | |
//Cities will be an array of cities, in order | |
}); | |
function getJSON(url,cb) { | |
$.getJSON(url,function(data) { |
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
cd ~/ | |
# Add QGIS repo | |
sudo add-apt-repository -s "deb http://qgis.org/debian trusty main" | |
# Add TileMill repo | |
sudo add-apt-repository ppa:developmentseed/mapbox | |
# Update/upgrade | |
sudo apt-get update && sudo apt-get upgrade |
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
with lcd("%s" % (project)): | |
commit = local("git log -g --pretty=%B -n 1") | |
print commit #This prints the right message | |
print commit # This doesn't |