Skip to content

Instantly share code, notes, and snippets.

@moricard
moricard / gist:4745465
Created February 9, 2013 14:33
different vishna load function
var news;
function load () {
d3.json("#path/feed.json", function(data){
//Everything here will be executed once the data has arrived.
news = data;
news.map( function(newsItem) {
//do the treatment for each newsItem here.
@moricard
moricard / gist:4697485
Created February 2, 2013 14:06
Visual Hacker News with text inside a force-graph node in d3.js
var vishna = (function() {
var urls = { //API urls
news : "http://hndroidapi.appspot.com/news/format/json/page/?appid=vishna&callback=?",
ask : "http://hndroidapi.appspot.com/ask/format/json/page/?appid=vishna&callback=?",
newest: "http://hndroidapi.appspot.com/newest/format/json/page/?appid=vishna&callback=?",
best : "http://hndroidapi.appspot.com/best/format/json/page/?appid=vishna&callback=?"
},
thread = /^(item[?]id[=][0-9]+)/, //regexp for HN thread posts
w = Math.max( $(window).width() * 0.85, 960 ), //width