Skip to content

Instantly share code, notes, and snippets.

View danasilver's full-sized avatar

Dana Silver danasilver

View GitHub Profile
@danasilver
danasilver / README.md
Last active August 29, 2015 13:59
Last Letter of First Names

A D3 recreation of David Taylor's visualization The meteoric rise of boys' names ending in 'n'.

The chart shows the number of children born with names ending in each letter. Adjust the slider to change the year. Toggle the checkboxes to show boys, girls, or both.

@danasilver
danasilver / README.md
Created March 26, 2014 21:28
Orange Trees

Circumference of orange trees over time.

Data comes from R's "Orange" dataset. Legend created with d3.legend.js (MIT License).

For CS465 at Middlebury College.

@danasilver
danasilver / README.md
Created March 13, 2014 21:06
U.S. Income Choropleth

A choropleth of the average per capita income by state according to the 2010 U.S. census. Hover over a state for more information.

@danasilver
danasilver / README.md
Last active August 29, 2015 13:57
GitHub Language Bar Chart
@danasilver
danasilver / .block
Last active December 18, 2016 02:14
Heady Topper Locations
license: MIT
@danasilver
danasilver / README.md
Last active August 29, 2015 13:57
U.S. Map

A simple demonstration of TopoJSON and interactivity. Mouseover to show the state's abbreviation and the latitude and longitude of the point.

In addition to D3, this visualization relies on TopoJSON. The map uses an Albers USA projection, for which Alaska is scaled by 0.35x, giving it a lie factor of 3. On mousemoves, the corresponding state abbreviation in the data is shown, and the latitude and longitude is computed by inverting the mouse position.

@danasilver
danasilver / athletes.csv
Created February 20, 2014 01:48
Sochi 2014 Athletes Data
age birthdate gender height name weight gold_medals silver_medals bronze_medals total_medals sport country
17 1996-04-12 Male 1.72 Aaron Blunck 68 0 0 0 0 Freestyle Skiing United States
27 1986-05-14 Male 1.85 Aaron March 85 0 0 0 0 Snowboard Italy
21 1992-06-30 Male 1.78 Abzal Azhgaliyev 68 0 0 0 0 Short Track Kazakhstan
21 1992-05-25 Male 1.68 Abzal Rakimgaliev 0 0 0 0 Figure Skating Kazakhstan
21 1992-07-30 Male 1.86 Adam Barwood 82 0 0 0 0 Alpine Skiing New Zealand
21 1992-12-18 Male 1.75 Adam Cieslar 57 0 0 0 0 Nordic Combined Poland
18 1995-04-22 Male 1.7 Adam Lamhamedi 76 0 0 0 0 Alpine Skiing Morocco
23 1990-09-13 Male 1.78 Adam Zampa 80 0 0 0 0 Alpine Skiing Slovakia
17 1996-07-01 Female 1.63 Adelina Sotnikova 0 0 0 0 Figure Skating Russian Fed.
@danasilver
danasilver / README.md
Last active November 6, 2017 12:48
Jekyll Pygments/Redcarpet Global Configs

Jekyll Pygments/Redcarpet Global Configs

A Jekyll plugin that enables global configuration options for Pygments.

  • Add pygments_global_config.rb to my-jekyll-project/_plugins/.

  • Add Pygments options to _config.yml

markdown: redcarpet
@danasilver
danasilver / citystategeo.js
Created July 17, 2013 20:11
Get only city and state from Google Maps API Reverse Geocoder
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {
@danasilver
danasilver / gist:6004934
Created July 16, 2013 01:02
Log user out of a Facebook app without logging out of facebook.com

Calling FB.logout() is effective, but it will also log the user out of facebook entirely, prompting him or her to enter an email and password to get back into your app.

Call FB.api({ method: 'Auth.revokeAuthorization' }); instead, which just revokes the Facebook auth token for your app. When the user goes to log in again, he or she will just have to click the "Okay" button to authorize your app again. This will, of course remove the app from the users list of apps on Facebook, but they chose to revoke access in the first place, so this is expected and (hopefully) welcome behavior.