Skip to content

Instantly share code, notes, and snippets.

View ryanpitts's full-sized avatar

Ryan Pitts ryanpitts

View GitHub Profile
@ryanpitts
ryanpitts / gist:5ef5f5b58f3a4e909dc2
Created April 30, 2014 19:38
processing data based on values in an object, which must be filtered based on key contents
// the issue here: We want to ignore census "label columns" for certain charts.
// We can identify these columns by the ".5" in their columnID. We're working
// from a `comparison.table.columns` object, which has columnIDs as keys. So
// the job here is to ignore all the columns in this object that have a "."
// in their key, and process the rest into chart data.
// one way is to grab a set of keys without ".", then make an object out of
// the columns that match the "good" keys, and process those for the chart
@ryanpitts
ryanpitts / gist:07d0bd506aedf88fe6b8
Last active August 29, 2015 14:00
census column name prefixer
// A user may need to view a column name in isolation, with no context
// as to its level of indent. Prefixed column names allow this:
//
// Female
// Car, truck or van
// Carpooled
// In 2-person carpool
//
// to be represented as:
//
@ryanpitts
ryanpitts / gist:10692666
Last active August 29, 2015 13:59
Brussia and Braveison projects
class Ball(object):
def __init__(self, size, color):
self.size = size
self.color = color
self.shape = 'spherical'
class ImaginaryBallCreature(Ball):
def __init__(self, size, color, requires_brushing, has_been_photographed):
Ball.__init__(self, size, color)
self.is_imaginary = True
{
"geography": {
"census_release": "ACS 2012 5-year",
"parents": {
"county": {
"total_population": 43890,
"short_name": "Sweetwater County",
"land_area": 27004865143,
"sumlevel": "050",
"full_name": "Sweetwater County, WY",
@ryanpitts
ryanpitts / gist:10678531
Created April 14, 2014 20:01
example Facebook and Twitter meta tags
<meta property="og:title" content="Census profile: Evanston, IL" />
<meta property="og:site_name" content="Census Reporter" />
<meta property="og:url" content="http://censusreporter.org/profiles/16000US1724582-evanston-il" />
<meta property="og:description" content="Population data and dollar figures from Evanston, broken down by category: Demographics, Economics, Families, Housing and Social." />
<meta property="og:type" content="article" />
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@CensusReporter">
<meta name="twitter:creator" content="@CensusReporter">
<meta name="twitter:title" content="Census profile: Evanston, IL">
@ryanpitts
ryanpitts / Ryan's Rush Timeline
Created April 1, 2014 20:24
Just one song from each Rush studio album, in chronological order.
Working Man
In The End
Bastille Day
2112 Overture
Closer To The Heart
The Trees
The Spirit Of Radio
Limelight
Subdivisions
Distant Early Warning
@ryanpitts
ryanpitts / gist:9676345
Created March 20, 2014 23:34
jsdelivr single request
<script src="//cdn.jsdelivr.net/g/jquery@2.1,d3js@3.4,typeahead.js@0.10,underscorejs@1.6,spinjs@1.3,handlebarsjs@1.3(handlebars.min.js)"></script>
@ryanpitts
ryanpitts / gist:9632711
Created March 19, 2014 00:00
hover stuff
chart.mousemove = function() {
var mouseTop = d3.mouse(this)[1],
mouseLeft = d3.mouse(this)[0],
bufferTop = chart.screenPosition.top + mouseTop - chart.hovercard.dimensions.height,
bufferRight = browserWidth - (chart.screenPosition.left + mouseLeft + chart.hovercard.dimensions.width);
chart.hovercard.position = {
top: (bufferTop < 10) ? mouseTop + 5 : mouseTop - chart.hovercard.dimensions.height - 5,
left: (bufferRight < 10) ? mouseLeft - chart.hovercard.dimensions.width - 5 : mouseLeft + 5
}
@ryanpitts
ryanpitts / embed_chart_test
Created March 13, 2014 21:35
testing embedded Census Reporter charts as data URIs
data:text/html;base64,PCFET0NUWVBFIGh0bWw+PGh0bWw+PGhlYWQ+PGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwOi8vY2Vuc3VzcmVwb3J0ZXIub3JnL3N0YXRpYy9jc3MvZW1iZWQuY2hhcnRzLmNzcyI+PC9oZWFkPjxib2R5PjxkaXYgaWQ9ImNlbnN1cy1jaGFydCIgY2xhc3M9ImNlbnN1cy1jaGFydC1lbWJlZCBjZW5zdXMtY2hhcnQtcGllIj48L2Rpdj48c2NyaXB0PnZhciBjaGFydERhdGEgPSB7Im1ldGFkYXRhIjogeyJ1bml2ZXJzZSI6ICJUb3RhbCBwb3B1bGF0aW9uIiwgImFjc19yZWxlYXNlIjogIkFDUyAyMDEyIDUteWVhciIsICJ0YWJsZV9pZCI6ICJiMDEwMDEifSwgInBlcmNlbnRfdW5kZXJfMTgiOiB7Im5hbWUiOiAiVW5kZXIgMTgiLCAidmFsdWVzIjogeyJ0aGlzIjogMy4wMywgInBsYWNlIjogMjEuNzEsICJjb3VudHkiOiAyMS43MX0sICJlcnJvciI6IHsidGhpcyI6IDIuNTcsICJwbGFjZSI6IDAuMjMsICJjb3VudHkiOiAwLjIzfSwgIm51bWVyYXRvcnMiOiB7InRoaXMiOiAxMDAuMCwgInBsYWNlIjogMTM0NzUzLjAsICJjb3VudHkiOiAxMzQ3NTMuMH0sICJudW1lcmF0b3JfZXJyb3JzIjogeyJ0aGlzIjogODQuMiwgInBsYWNlIjogMTQyOS44LCAiY291bnR5IjogMTQyOS44fSwgImluZGV4IjogeyJ0aGlzIjogMTAwLjAsICJwbGFjZSI6IDE0LjAsICJjb3VudHkiOiAxNC4wfSwgImVycm9yX3JhdGlvIjogeyJ0aGlzIjogODQuOCwgInBsYWNlIjogMS4xLCAiY291bnR5IjogMS4xfX0sICJwZXJjZW50XzE4X3

Keybase proof

I hereby claim:

  • I am ryanpitts on github.
  • I am ryanpitts (https://keybase.io/ryanpitts) on keybase.
  • I have a public key whose fingerprint is 1E15 6202 4D0A 5B10 388D 0966 257B 2087 4726 63F0

To claim this, I am signing this object: