Skip to content

Instantly share code, notes, and snippets.

@caseycesari
caseycesari / avi-map-carto.scss
Created March 6, 2013 17:41
Carto styled used to style the parcel layer on http://apps.axisphilly.org/avi-map.
#parcelswtax {
polygon-opacity: 0.8;
[tax_change > 4] { polygon-fill: #7F0000 }
[tax_change > 2][tax_change <= 4] { polygon-fill: #B2182B }
[tax_change > 1][tax_change <= 2] { polygon-fill: #D6604D }
[tax_change > .5][tax_change <= 1] { polygon-fill: #F4A582 }
[tax_change > .1] [tax_change <= .5] { polygon-fill: #FDDBC7 }
[tax_change >= -.1][tax_change <= .1] { polygon-fill: #777 }
[tax_change < -.1] [tax_change > -.5] { polygon-fill: #bedef0 }
@caseycesari
caseycesari / avi-map-sql.md
Last active December 14, 2015 14:29
The SQL for creating a parcel layer simliar to the one that powers http://apps.axisphilly.org/avi-map

These commands are all run within the psql command line tool.

Create table for tax year 2013 data

CREATE TABLE tx_2013 (
  Acct_Num varchar(9),
  Address text,
  Unit text,
  Homestd_Ex text,

Prop_Cat text,

axis.Views.ArticleContainer = Backbone.View.extend({
tagName: 'div',
className: 'row article-container view',
initialize: function() {
this.template = _.template($('#single-article-container-template').html());
this.article = new axis.Views.Article({model: this.model});
this.sidebar = new axis.Views.ArticleSidebar({model: this.model});
},
@caseycesari
caseycesari / gist:3828861
Created October 3, 2012 18:33
311 rfp links
[ { title: 'General Requirements',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211210011552020211210011621271N&ext=xlsx' },
{ title: 'IT Requirements',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211210011552020211210011622021N&ext=xlsx' },
{ title: 'Open ended Questions',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211210011552020211210011622401N&ext=docx' },
{ title: 'Shared IT Infrastructure',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211210011552020211210011623391N&ext=docx' },
{ title: 'RFP Proposal',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211210011552020211210011624271N&ext=pdf' },
@caseycesari
caseycesari / gist:3828843
Created October 3, 2012 18:30
lobbying rfp links
[ { title: 'OEO Solicitation for Participation Form',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211209241237530211209241318291N&ext=xlsx' },
{ title: 'Appendix I',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211209241237530211209241631401N&ext=pdf' },
{ title: 'Appendix J',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211209241237530211209241632401N&ext=pdf' },
{ title: 'Lobbying Software RFP Proposal',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211209241237530211209251056121N&ext=pdf' },
{ title: 'Appendix D',
url: 'https://secure.phila.gov/ECONTRACT/Documents/frmPDFWindow.aspx?docid=211209241237530211209261052471N&ext=xlsx' } ]
@caseycesari
caseycesari / gist:3802564
Created September 28, 2012 23:19
simple leaflet demo
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.ie.css" />
<![endif]-->
<title>USA Leaflet Demo</title>
<style type="text/css">
app.get('/home/:foo', function(req, res){
res.redirect('/state/' + req.params.foo);
});
app.get('/state/:name', function(req, res){
res.send(req.params.name);
});
2012-06-15T15:55:32+00:00 app[web.1]:
2012-06-15T15:55:32+00:00 app[web.1]: /app/server.js:34
2012-06-15T15:55:32+00:00 app[web.1]: connect.router(function(app) {
2012-06-15T15:55:32+00:00 app[web.1]: ^
2012-06-15T15:55:32+00:00 app[web.1]: TypeError: Object function createServer() {
2012-06-15T15:55:32+00:00 app[web.1]: function app(req, res){ app.handle(req, res); }
2012-06-15T15:55:32+00:00 app[web.1]: app.route = '/';
2012-06-15T15:55:32+00:00 app[web.1]: utils.merge(app, proto);
2012-06-15T15:55:32+00:00 app[web.1]: utils.merge(app, EventEmitter.prototype);
2012-06-15T15:55:32+00:00 app[web.1]: app.use(arguments[i]);
https.get({
host: 'api.cloudmine.me',
headers: {'X-CloudMine-ApiKey': CM_KEY},
path: '/v1/app/' + CM_APP + '/text?keys=' + req.params.email
}, function(cmres) {
res.attachment('test.csv');
cmres.on('data', function(chunk) {
data += chunk;
// do some stuff to data
}).on('end', function() {
@caseycesari
caseycesari / scrapper_wiki_lobby
Created February 23, 2012 05:09
Scraperwiki lobbying data
Run the code below here: https://scraperwiki.com/scrapers/new/python?template=advanced-scraping-pdfs#
import scraperwiki
import urllib2
import lxml.etree
url = "http://www.phila.gov/ethicsboard/pdfs/lobbying%20registrations%20through%201.27.12_lobbyists.pdf"
pdfdata = urllib2.urlopen(url).read()
print "The pdf file has %d bytes" % len(pdfdata)