Skip to content

Instantly share code, notes, and snippets.

View johan's full-sized avatar

Johan Sundström johan

View GitHub Profile
// ==UserScript==
// @name Github: unfold commit history
// @namespace http://github.com/johan/
// @description Adds an "unfold all changesets" button on Commit History pages at github, which lets you browse the source changes without leaving the page. /Click a commit header again to re-fold it.)
// @include https://github.com/*/commits/*
// @include http://github.com/*/commits/*
// ==/UserScript==
(function() {
if ('undefined' == typeof __PAGE_SCOPE_RUN__) { // unsandbox, please!
@johan
johan / require.js
Created August 18, 2011 00:04 — forked from erikvold/require.js
Imports a commonjs style javascript file with loadSubScrpt for restartless Firefox add-ons.
/* Imports a commonjs style javascript file with loadSubScrpt
* By Erik Vold <erikvvold@gmail.com> http://erikvold.com/
*
* @param src (String)
* The url of a javascript file.
*/
(function(global) {
var modules = {}
, tools = {}
, baseURI, io, js;
@johan
johan / index.html
Created September 24, 2011 06:42 — forked from mbostock/.block
Axis Component
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@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 / 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