Skip to content

Instantly share code, notes, and snippets.

View johan's full-sized avatar

Johan Sundström johan

View GitHub Profile
@johan
johan / README.md
Last active March 1, 2024 05:26 — forked from mbostock/.block

Hourly solar analemmas (ignoring daylight savings time) as seen from San Francisco in 2014.

@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
Last active November 6, 2021 14:09 — forked from NV/Readme.md
JS debug breakpoint / log snippets

stopBefore.js

2min screencast

These tools inject a breakpoint, console.log or console.count in any function you want to spy on via stopBefore('Element.prototype.removeChild') or ditto stopAfter, logBefore / logAfter / logAround / logCount.

Works in Chrome DevTools and Safari Inspector; Firefox dev tools reportedly less so.

@johan
johan / index.html
Created November 25, 2011 00:24 — forked from johan/dnd.js
Animated Draggable Spinny Globe
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>d3.js Spinny Globe from Mike Bostock's SVG Open 2011 keynote</title>
<script src="http://mbostock.github.com/d3/d3.js"></script>
<script src="http://mbostock.github.com/d3/d3.geo.js"></script>
<link type="text/css" rel="stylesheet" href="http://mbostock.github.com/d3/talk/20111018/style.css"/>
<link type="text/css" rel="stylesheet" href="http://mbostock.github.com/d3/talk/20111018/colorbrewer/colorbrewer.css"/>
<style type="text/css">
@johan
johan / index.html
Created October 28, 2011 08:43 — forked from johan/index.html
Bl.ocks.org and other gist index by user
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Index of all bl.ocks.org pages owned by a github user</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.3"></script>
<base target="_top">
<style>
body { padding: 0.5em; margin: 0; }
h1 { padding: 0; margin: 0; }
@johan
johan / README.md
Last active January 16, 2020 12:17 — forked from benelsen/README.md
Earth, night and day sides.
@johan
johan / google-map-marker-with-shadow.js
Created May 21, 2012 17:02 — forked from simonw/google-map-marker-with-shadow.js
google-map-marker-with-shadow.js
/* Here's how to add a coloured marker to a Google Map with a shadow in the
right place.
The pin itself used to be dynamically generated via Google Charts:
//chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|3491FF|000000
documented here:
https://developers.google.com/chart/image/docs/gallery/dynamic_icons
Note however that this API was marked as deprecated on April 20th 2012
although it's not clear when or if it will be turned off.
@johan
johan / dnd.js
Created November 25, 2011 06:55 — forked from johan/index.html
Spinny Globe with drag-and-drop-geojson-file support
// http://www.html5rocks.com/en/tutorials/file/dndfiles/
d3.select('svg')
.on('dragover', handleDragOver)
.on('drop', handleFileSelect)
;
function handleFileSelect() {
var event = d3.event
, files = event.dataTransfer.files // FileList object
, about = []
@johan
johan / .block
Created July 20, 2016 11:52 — forked from mbostock/.block
Sleep Cycles
license: gpl-3.0