Skip to content

Instantly share code, notes, and snippets.

View johan's full-sized avatar

Johan Sundström johan

View GitHub Profile
@johan
johan / ted-postrank.rb
Created October 3, 2011 06:39 — forked from igrigorik/ted-postrank.rb
Makes a tsv of the popularity of all TED talks to date using Postrank, if you have a Postrank API key
#! /usr/bin/env ruby
# good with ruby 1.8.7
# not good: the Postrank key used accepts no more traffic, and Google has since
# acquired Postrank, so there currently isn't any way of getting a new one. :-(
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'digest/md5'
require 'fastercsv'
@johan
johan / autofork.js
Created October 22, 2011 16:05 — forked from mbostock/autofork.js
Autoforking
var f = document.createElement("form");
f.method = "POST";
f.action = "/fork" + location.pathname;
f.appendChild(document.querySelector("input[name=authenticity_token]"));
f.submit();
@johan
johan / readme.md
Last active October 17, 2022 23:14 — forked from johan/autofork.js
(Re)fork any gist, including your own

Want to fork your own gists? No fork button? No problem! Install this user script by clicking refork.user.js' "raw" link down below: ⇓

@johan
johan / README.md
Created October 22, 2011 19:29
User script to make bl.ocks.org links from any gist featuring an index.html file

Want to see a gist's index.html at bl.ocks.org? No problem! Install this user script by clicking the "raw" link below: ⇘

Then have a peek at https://gist.github.com/1256572 for instance. The gist should now feature a "@bl.ocks.org" link.

@johan
johan / README.md
Created October 22, 2011 20:43
Structured JSON data about the Recettear 1.08 (English) world in general, and its items in particular.

This data was excavated from the English version of Recettear 1.08 via https://gist.github.com/1306508 - and especially so the items part (in other words: almost all of it is auto generated, save for the smaller parts up top, which I use in some d3.js data visualizations of this data set).

The recettear-images.json data set is correlated to the indices of the recettear-data.json's "items" array - as each image is used for one or more items, the keys of the object are data urls, and the values are arrays of item indices.

(Which, in retrospect, was a more convenient than future-safe encoding – but it's fairly easy to remap them to item id:s later, should the need arise.)

@johan
johan / README.md
Created October 22, 2011 21:21
Data excavation from Recettear 1.08, English version, via the Chrome dev tools' javascript console.

The items data part of https://gist.github.com/1306472 was produced by pasting the above into the Google Chrome javascript console. (This way, it's easier to regenerate for some later version of the game data.)

@johan
johan / index.html
Created October 23, 2011 06:06 — forked from mbostock/.block
Recettear characters vs force layout
<!DOCTYPE html>
<html>
<head id="head">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Recettear characters</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script>
<style type="text/css">
@johan
johan / amo.js
Created October 23, 2011 14:46 — forked from mbostock/.block
Greasemonkey users by browser version (1 month)
// loads AMO browser stats for an AMO public-stats addon (748 = Greasemonkey) for the
// last half a year (or some other number of days), cleans them up and passes them as
// cb([{ date: <Date object>, total: N, "Firefox/6.0": N, … }, { date: … }, …])
function get_amo_stats(cb, addon, days) {
var pipe = 'ed7df07cb426304321a88e3cb875226c'
, nth = get_amo_stats.nth = (get_amo_stats.nth || 0) + 1
, name = 'cb' + nth.toString(36)
, now = new Date
, from = new Date(+now - 864e5 * (days || 365 >> 1))
, aurl = 'https://addons.mozilla.org/en-US/firefox/statistics/csv/'+ (addon || 748)
@johan
johan / index.html
Created October 23, 2011 18:28 — forked from johan/amo.js
Greasemonkey users by browser version (6 months)
<!DOCTYPE html>
<html>
<head>
<title>Greasemonkey users by browser version</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?1.29.1"></script>
<script type="text/javascript" src="load_amo_stats.js"></script>
<style type="text/css">
@johan
johan / README.md
Created October 24, 2011 04:53 — forked from mbostock/.block
D3 Show Reel

The first 15 seconds of the D3 show reel. See full video at http://vimeo.com/29862153. Includes seamless transitions between the following visualization types:

  • lines
  • horizons
  • areas
  • stacked areas
  • streamgraph
  • overlapping areas
  • grouped bars
  • stacked bars