Skip to content

Instantly share code, notes, and snippets.

Avatar

Johan Sundström johan

View GitHub Profile
@johan
johan / Makefile
Created Jan 24, 2017
Makefile of the steps in Mike Bostock's command-line cartography tutorial, parts 1-4 https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c
View Makefile
# request one at http://api.census.gov/data/key_signup.html and paste it below
CENSUS_API_KEY=YOUR_CODE_HERE
# a factor 1609.34 squared
SQ_M_TO_SQ_MI=2589975.2356
#prereqs:
# npm install -g shapefile # 0.6.1
# npm install -g d3-geo-projection # 1.2.1
# npm install -g ndjson-cli # 0.3.0
@johan
johan / index.html
Created Nov 25, 2011 — forked from johan/dnd.js
Animated Draggable Spinny Globe
View index.html
<!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 / readme.md
Last active Mar 23, 2021 — forked from johan/autofork.js
(Re)fork any gist, including your own
View readme.md

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 / octocat.svg
Created Jun 4, 2011
Github octocat avatar, SVG format
View octocat.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johan
johan / laughing-man.svg
Created Jul 6, 2011
The Laughing Man (Ghost in the Shell), 1000 byte SVG :-)
View laughing-man.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johan
johan / index.html
Created Jul 20, 2012
HTML5 GPS tracker
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML5 GPS</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="style.css">
</head>
@johan
johan / README.md
Last active Jan 31, 2021
A micro-library (4k minified) for DRY:ing up the boring boilerplate of user scripts.
View README.md

on.js

The fun part of user scripting is deciding what happens. The boring part is scavenging the DOM for bits of templated data, or elements you want to mod.

Have on.js do it for you!

@johan
johan / README.md
Last active Jan 28, 2021 — forked from NV/Readme.md
JS debug breakpoint / log snippets
View README.md

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 Oct 28, 2011 — forked from johan/index.html
Bl.ocks.org and other gist index by user
View index.html
<!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 / index.md
Last active Nov 20, 2020
osx + java 7 = painfully easy
View index.md

Step 1

Does your osx terminal speak java 7? Start Terminal.app and try: java -version:

> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)