Skip to content

Instantly share code, notes, and snippets.

@davidfischer
Created June 4, 2012 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidfischer/2866246 to your computer and use it in GitHub Desktop.
Save davidfischer/2866246 to your computer and use it in GitHub Desktop.
How Social is Your Code?
When one says "social coding" I ask "how social"? One measure of social-ness is the number of distinct collaborators.
The data is from the github.timeline dataset. The visualization uses D3 and is adapted from the Sunburst example.
Click http://bl.ocks.org/2866246 to view it in all its glory.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
<style type="text/css">
label {
display: block;
float: left;
width: 100px;
text-align: right;
font-weight: bold;
padding-right: 10px;
}
#tooltip p {
clear: both;
margin: 4px 0;
}
</style>
</head>
<body>
<div id="chart"></div>
<script type="text/javascript">
var width = 960,
height = 500,
radius = Math.min(width, height) / 2,
color = d3.scale.category20c();
var vis = d3.select("#chart").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var tooltip = d3.select("body").append("div")
.attr("id", "tooltip")
.style("display", "none")
.style("background-color", "rgba(242, 242, 242, .6)")
.style("border", "1px solid #666")
.style("padding", "5px")
.style("position", "absolute");
var partition = d3.layout.partition()
.sort(null)
.size([2 * Math.PI, radius * radius])
.value(function(d) { return d.collaborators; });
var arc = d3.svg.arc()
.startAngle(function(d) { return d.x; })
.endAngle(function(d) { return d.x + d.dx; })
.innerRadius(function(d) { return 50; })
.outerRadius(function(d) { return Math.sqrt(d.y + d.dy); });
d3.csv("social.csv", function(data) {
var path = vis.data([format_data(data)]).selectAll("path")
.data(partition.nodes)
.enter().append("path")
.text(function(d) { return d.name ? d.name : ""; })
.attr("display", function(d) { return d.name ? "none" : null; }) // hide inner rings
.attr("d", arc)
.attr("fill-rule", "evenodd")
.style("stroke", "#fff")
.style("fill", function(d) { return color(d.name ? d.name : d.repository_language); })
.on("mouseover", function(d) {
if(!d.repository_name) { return; }
var m = d3.mouse(d3.select("body").node());
tooltip.style("display", null)
.style("left", m[0] + 30 + "px")
.style("top", m[1] - 20 + "px")
.html(["<p><label>Project:</label>" + d.repository_name + "</p>",
"<p><label>Collaborators:</label>" + d.collaborators + "</p>",
"<p><label>Language:</label>" + d.repository_language + "</p>"].join(""));
})
.on("mouseout", function(d) {
tooltip.style("display", "none");
});
});
function format_data(data) {
// convert CSV to hierarchical format that d3 expects
var json = {"name": "Social Code", "children": []};
for(var i = 0; i < data.length; i += 1) {
var index = -1;
for(var j = 0; j < json['children'].length; j += 1) {
if(json['children'][j]['name'] == data[i]['repository_language']) {
index = j;
break;
}
}
if(index == -1) {
json['children'].push({
"name": data[i]['repository_language'],
"children": []
});
index = json['children'].length - 1;
}
json['children'][index]['children'].push(data[i]);
}
return json;
}
</script>
</body>
</html>
SELECT repository_name,
repository_language,
COUNT(actor) AS collaborators
FROM (
SELECT repository_name,
repository_language,
actor
FROM [githubarchive:github.timeline]
GROUP BY repository_name,
repository_language,
actor
) AS t
WHERE repository_language != ''
GROUP BY repository_name,
repository_language
HAVING collaborators > 250
ORDER BY collaborators DESC
repository_name repository_language collaborators
bootstrap JavaScript 10454
dotfiles VimL 5884
sample_app Ruby 3966
rails Ruby 3651
first_app Ruby 3588
meteor JavaScript 3402
demo_app Ruby 3219
jQuery-File-Upload JavaScript 3217
hw3_rottenpotatoes Ruby 3165
homebrew Ruby 2983
node JavaScript 2962
django Python 2788
wysihtml5 JavaScript 2614
BrowserQuest JavaScript 2510
backbone JavaScript 2420
Prince-of-Persia-Apple-II Assembly 2417
html5-boilerplate JavaScript 2362
jquery JavaScript 2360
d3 JavaScript 2344
Font-Awesome JavaScript 2333
impress.js JavaScript 2254
dotfiles Shell 2243
php-src C 2008
hw4_rottenpotatoes Ruby 1836
Timeline JavaScript 1790
oh-my-zsh Shell 1778
three.js JavaScript 1712
mailcheck JavaScript 1707
hammer.js JavaScript 1702
linux C 1685
brackets JavaScript 1542
less.js JavaScript 1535
jquery-mobile JavaScript 1532
symfony PHP 1471
foresight.js JavaScript 1415
chosen JavaScript 1378
mosh C++ 1375
socket.io JavaScript 1339
underscore JavaScript 1336
grunt JavaScript 1326
jekyll Ruby 1309
coffee-script CoffeeScript 1304
express JavaScript 1290
Modernizr JavaScript 1264
mruby C 1258
ember.js JavaScript 1236
jQuery-Knob JavaScript 1216
redis C 1203
todomvc JavaScript 1173
octopress Ruby 1171
idiomatic.js JavaScript 1160
gitlabhq Ruby 1139
CodeIgniter PHP 1132
foundation PHP 1132
backbone-fundamentals JavaScript 1120
bootstrap-wysihtml5 JavaScript 1120
javascript-patterns JavaScript 1112
cubism JavaScript 1087
jquery-ui JavaScript 1052
AFNetworking Objective-C 1040
devise Ruby 1026
obtvse Ruby 1020
statsd JavaScript 1017
legit Python 1014
angular.js JavaScript 994
mojito JavaScript 988
gmaps JavaScript 969
rainbow JavaScript 967
moment JavaScript 935
flask Python 928
XobotOS Java 923
mysql C++ 921
diaspora Ruby 917
yii PHP 906
tesseract JavaScript 891
requests Python 889
fr_public C++ 887
Play20 Scala 881
scrollpath JavaScript 857
keymaster JavaScript 845
android Python 827
vert.x Java 818
TrinityCore C++ 807
jquery-ui-bootstrap JavaScript 796
pdf.js JavaScript 784
git C 783
RestKit Objective-C 773
Leaflet JavaScript 770
twitter-bootstrap-rails Ruby 769
githug Ruby 764
folly C++ 762
handlebars.js JavaScript 757
three20 Objective-C 756
Scroll-Effects JavaScript 755
active_admin Ruby 752
ace JavaScript 748
Kickstrap JavaScript 745
jquery-pjax JavaScript 743
tinycon JavaScript 740
phonegap-plugins Java 734
twui Objective-C 731
fake-s3 Ruby 723
rickshaw JavaScript 721
dotvim VimL 720
vimfiles VimL 719
facebook-ios-sdk Objective-C 717
t Ruby 717
zepto JavaScript 712
history.js JavaScript 712
lolcommits Ruby 709
zf2 PHP 705
retinajs CoffeeScript 695
Flotr2 JavaScript 691
ActionBarSherlock Java 682
reveal.js JavaScript 677
locache JavaScript 676
dotfiles Emacs Lisp 673
knockout JavaScript 671
jasmine JavaScript 665
rails-api Ruby 664
fixie JavaScript 658
tornado Python 656
resque Ruby 654
gitflow Shell 651
mustache.js JavaScript 651
raphael JavaScript 649
reddit Python 648
jade JavaScript 648
ShareKit Objective-C 647
graphene CoffeeScript 646
dotfiles Ruby 645
backbone-boilerplate JavaScript 644
phonegap JavaScript 641
roots PHP 641
elasticsearch Java 640
crossfilter JavaScript 640
requirejs JavaScript 638
lodash JavaScript 638
cakephp PHP 633
jswiki JavaScript 633
core PHP 629
cssarrowplease JavaScript 628
inbox.py Python 623
storm Java 622
masonry JavaScript 621
SlickGrid JavaScript 617
phonegap-start JavaScript 611
GMGridView Objective-C 608
mocha JavaScript 608
GPUImage Objective-C 608
hiphop-php C++ 606
MPFoldTransition Objective-C 606
UglifyJS JavaScript 599
turn.js JavaScript 598
julia C 597
npm JavaScript 593
xbmc C 592
facebook-php-sdk PHP 590
LIExposeController Objective-C 590
novocaine Objective-C 587
MBProgressHUD Objective-C 586
spree Ruby 586
ruby Ruby 585
activerecord-reputation-system Ruby 581
phantomjs C++ 577
vagrant Ruby 575
bootstrap-sass Ruby 574
brunch CoffeeScript 574
gmvault Python 571
SparkleShare C# 571
WordPress PHP 569
cloud9 JavaScript 568
ctrlp.vim VimL 564
laravel PHP 557
mongo C++ 556
stroll.js JavaScript 555
real-shadow JavaScript 555
vimrc VimL 550
CodeMirror2 JavaScript 547
pinry Python 546
natural JavaScript 544
bundler Ruby 543
solarized VimL 543
gaskit JavaScript 543
emscripten JavaScript 540
Kalendae JavaScript 538
PrettyKit Objective-C 536
paperclip Ruby 536
sinatra Ruby 535
async JavaScript 534
jquery-cookie JavaScript 531
ReactiveCocoa Objective-C 531
capistrano Ruby 530
tomorrow-theme VimL 527
Respond JavaScript 526
Skeleton JavaScript 523
composer PHP 523
rails_admin Ruby 522
scm_breeze Shell 522
node2dm JavaScript 522
php-sdk PHP 520
react PHP 514
cancan Ruby 513
320andup JavaScript 512
noty JavaScript 510
sigma.js JavaScript 509
etherpad-lite JavaScript 507
envisionjs JavaScript 506
asi-http-request Objective-C 504
html5shiv JavaScript 502
boto Python 502
ievms Shell 502
jquery.transit JavaScript 498
appjs C++ 488
redmine Ruby 483
Wookmark-jQuery JavaScript 483
everyauth JavaScript 480
wemux Shell 477
carrierwave Ruby 476
refinerycms Ruby 476
stylus JavaScript 475
janus VimL 471
ruby-style-guide Ruby 471
js-assessment JavaScript 471
CocoaPods Ruby 470
compass Ruby 470
EpicEditor JavaScript 469
backbone.marionette JavaScript 466
JSON-js JavaScript 466
sidekiq Ruby 463
uptime JavaScript 462
SVPullToRefresh Objective-C 460
SDWebImage Objective-C 458
screenfull.js JavaScript 457
mongoose JavaScript 455
markup Ruby 454
dataset JavaScript 453
SignalR C# 452
gitolite Perl 450
DataKit Objective-C 449
connect JavaScript 447
jquery-validation JavaScript 447
RubyMotionSamples Ruby 444
cube JavaScript 439
ShareJS JavaScript 439
MagicalRecord Objective-C 439
chaplin JavaScript 438
mongoid Ruby 436
puma Ruby 436
kandan JavaScript 436
request JavaScript 434
hubot CoffeeScript 432
rbenv Shell 431
file-uploader JavaScript 429
django-tastypie Python 428
android_frameworks_base Java 427
node-mongodb-native JavaScript 426
zxcvbn CoffeeScript 425
cookbooks Ruby 425
MGTileMenu Objective-C 425
morris.js CoffeeScript 425
json-framework Objective-C 424
simple_form Ruby 424
Sick-Beard Python 423
device.js JavaScript 419
Slim PHP 419
sentry Python 415
OpenELEC.tv Shell 414
derby CoffeeScript 414
JSONKit Objective-C 409
EaselJS JavaScript 407
ansible Python 405
vim-pathogen VimL 404
html5demos JavaScript 404
fancyBox JavaScript 403
isotope JavaScript 403
facebook-android-sdk Java 402
vim VimL 399
cocos2d-iphone Objective-C 395
dokuen Ruby 392
laptop Shell 392
tasseo JavaScript 390
spine JavaScript 390
ViewDeck Objective-C 388
WebPutty Python 387
omniauth Ruby 387
CraftBukkit Java 386
css3-google-buttons JavaScript 385
leiningen Clojure 385
browsercms Ruby 385
rabl Ruby 384
clojure Java 383
geddy JavaScript 381
spring-framework Java 381
OpenUDID Objective-C 381
sass Ruby 381
dnspod-sr C 379
capybara Ruby 379
bootstrap-datepicker JavaScript 378
OCCalendar Objective-C 376
zerorpc-python Python 375
game-of-life Java 374
phpunit PHP 374
hello-world ActionScript 371
jPlayer JavaScript 371
rvm Shell 370
rq Python 370
tapkulibrary Objective-C 369
JASidePanels Objective-C 369
play Ruby 368
iCarousel Objective-C 368
filtrify JavaScript 366
delayed_job Ruby 366
hogan.js JavaScript 363
grape Ruby 363
MGBox Objective-C 362
jekyll-bootstrap Ruby 362
nu Objective-C 361
colorbox JavaScript 360
skrollr JavaScript 358
nimbus Objective-C 357
focused_controller JavaScript 356
paper.js JavaScript 356
Swipe JavaScript 355
AndEngine Java 355
tinyissue PHP 355
sspulltorefresh Objective-C 355
Iconic JavaScript 353
backbone.offline CoffeeScript 352
iscroll JavaScript 352
Induction Objective-C 352
node-qt C++ 351
MKNetworkKit Objective-C 351
FlexSlider JavaScript 349
deck.js JavaScript 349
BubbleWrap Ruby 349
macvim C 348
django-social-auth Python 347
CocosBuilder Objective-C 347
QuickDialog Objective-C 346
fog Ruby 345
prototype JavaScript 344
plupload C# 343
_s PHP 343
cconf.github.com JavaScript 343
firebug JavaScript 342
railsinstaller_demo Ruby 341
NHP-Theme-Options-Framework PHP 341
pyapns Python 339
Backbone-relational JavaScript 339
CoffeeConsole JavaScript 339
Cinnamon C 339
plumbum Python 338
stylo JavaScript 338
sass-twitter-bootstrap JavaScript 337
ADLivelyTableView Objective-C 336
strong_parameters Ruby 336
FitText.js JavaScript 335
yui3 JavaScript 335
pandas Python 334
riloadr JavaScript 334
video-js JavaScript 333
SVProgressHUD Objective-C 333
XRegExp JavaScript 333
python-guide Python 332
node_redis JavaScript 332
forever JavaScript 332
hw2_rottenpotatoes Ruby 331
vim-fugitive VimL 331
vim-config VimL 331
PHP-CS-Fixer PHP 330
httpie Python 330
fabric Python 330
backbone.paginator JavaScript 330
openFrameworks C 329
jquery-pageslide JavaScript 329
spin.js JavaScript 328
backbone-directory PHP 328
batsd Ruby 327
jquery-backstretch JavaScript 327
node-inspector JavaScript 327
objectify Ruby 326
active_merchant Ruby 326
fmdb Objective-C 325
pelican Python 325
dotfiles Python 324
netty Java 324
mooege C# 324
ipython Python 323
arale JavaScript 323
twitter-text-objc Objective-C 323
idev-recipes Objective-C 322
progit JavaScript 322
fontomas JavaScript 322
spf13-vim VimL 322
factory_girl Ruby 322
data JavaScript 321
jquery-popbox JavaScript 321
scripts Shell 321
rauth Python 321
gaia JavaScript 320
phabricator PHP 320
scala Scala 319
infinite-scroll JavaScript 319
wp-svbtle PHP 319
qunit JavaScript 318
picturefill JavaScript 318
blog Ruby 317
lessphp PHP 317
socketstream JavaScript 316
jquerytools JavaScript 316
clojurescript Clojure 314
foreman Ruby 314
AQGridView Objective-C 313
recess JavaScript 313
ambrose Java 312
ThinkUp PHP 311
Twig PHP 311
kaminari Ruby 310
guard Ruby 310
simple Python 309
CocoaAsyncSocket Objective-C 309
uscode Python 309
recursive-drawing JavaScript 307
hubot-scripts CoffeeScript 306
rust Rust 306
superscrollorama JavaScript 306
SyntaxHighlighter JavaScript 305
workflow Python 304
.vim VimL 304
mono C# 304
gollum Ruby 304
iOS-boilerplate Objective-C 301
celluloid Ruby 301
Ghost.py JavaScript 300
Android-ViewPagerIndicator Java 300
doctrine2 PHP 300
vundle VimL 300
RestSharp C# 299
node-browserify JavaScript 297
B2G Shell 296
webpy Python 295
jenkins Java 294
KNSemiModalViewController Objective-C 294
syntastic VimL 292
veewee Ruby 291
dustjs JavaScript 291
EGOTableViewPullRefresh Objective-C 291
jQuery-CreditCardValidator JavaScript 290
pouchdb JavaScript 289
khan-exercises JavaScript 289
jshint JavaScript 289
rack Ruby 288
squeel Ruby 288
copycopter-server Ruby 287
mediaelement JavaScript 287
water JavaScript 287
jsdom JavaScript 286
jsrender JavaScript 285
Backbone.ModelBinder JavaScript 285
html2canvas JavaScript 285
vim-powerline VimL 285
secureudid Objective-C 284
fullcalendar JavaScript 284
juggernaut JavaScript 283
memcached C 283
ant-build-script Shell 283
jQTouch JavaScript 283
emacs-starter-kit Emacs Lisp 283
cucumber Ruby 283
openlayers JavaScript 282
casperjs JavaScript 282
Sequence JavaScript 281
ECSlidingViewController Objective-C 281
chef Ruby 281
fpm Ruby 281
node-mysql JavaScript 281
Arduino Java 279
xsbt Scala 279
node-http-proxy JavaScript 279
mobile-boilerplate JavaScript 278
clippy.js JavaScript 278
octogit Python 278
debugger Emacs Lisp 277
headphones Python 277
ruby-mmo Ruby 276
bigbluebutton Java 275
colorific Python 275
Silex PHP 275
processing-js Java 274
DTCoreText Objective-C 274
mangos C++ 273
titanium_mobile Objective-C 273
hub Ruby 273
travis-ci Ruby 273
bourbon Ruby 272
kartograph.js JavaScript 270
fnordmetric Ruby 270
koala Ruby 270
authority Ruby 269
smoothie JavaScript 267
pow CoffeeScript 267
pry Ruby 267
Responsive-Images JavaScript 266
Cookies JavaScript 266
vcap Ruby 266
jQ.Mobi JavaScript 265
django-debug-toolbar Python 263
sstoolkit Objective-C 263
SkyFireEMU C++ 262
nerdtree VimL 262
depot Ruby 262
pyrocms PHP 262
Ham PHP 262
puppet Ruby 261
MacRuby Ruby 261
PhotoSwipe JavaScript 260
gitscm-next Ruby 260
GreenDroid Java 259
kss Ruby 258
tilemill JavaScript 258
phpredis C 257
backboneboilerplate JavaScript 257
punch JavaScript 257
Bukkit Java 257
mageplus PHP 257
stream-lib Java 256
weary Ruby 255
UIDevice-with-UniqueIdentifier-for-iOS-5 Objective-C 255
prefixfree JavaScript 255
CODialog Objective-C 254
Alternativa3D ActionScript 254
plugins.jquery.com JavaScript 254
underscore.string JavaScript 254
assetic PHP 254
salt Python 254
ruby-china Ruby 254
JX JavaScript 253
Rucksack JavaScript 253
geocoder Ruby 253
sunspot Ruby 253
DCIntrospect Objective-C 253
tower CoffeeScript 252
Physijs JavaScript 252
Aloha-Editor JavaScript 252
eventmachine Ruby 252
XVim Objective-C 251
backup Ruby 251
emacs.d Emacs Lisp 251
marginalia Ruby 251
her Ruby 251
backbonetutorials JavaScript 251
ospriet JavaScript 251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment