Skip to content

Instantly share code, notes, and snippets.


Johan Sundström johan

View GitHub Profile
johan / jquery.nodoubletapzoom.js
Created Mar 15, 2012
A jQuery plugin to selectively disable the iOS double-tap-to-zoom action on specific page elements (and have that generate two click events instead).
View jquery.nodoubletapzoom.js
// jQuery no-double-tap-zoom plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
var IS_IOS = /iphone|ipad/i.test(navigator.userAgent);
$.fn.nodoubletapzoom = function() {
if (IS_IOS)
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
johan / index.html
Created Jul 20, 2012
HTML5 GPS tracker
View index.html
<!DOCTYPE html>
<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">
johan /
Last active Jul 3, 2020 — forked from NV/
JS debug breakpoint / log snippets


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 / 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 / editdistance
Last active Apr 29, 2020
list edit distances between all inputs of the same length, ascending order
View editdistance
#! /usr/bin/env node
// for a JSON array of strings, or an array of lines on stdin,
// shows edit distances between all the inputs, ascending
const fs = require('fs');
const ed = require('edit-distance');
// read all strings from stdin:
let names = fs.readFileSync(0, 'utf-8');
johan / JSXTransformer.min.js
Last active Apr 13, 2020
Week Calendar of Life
View JSXTransformer.min.js
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";var ReactTools=_dereq_("../main");var inlineSourceMap=_dereq_("./inline-source-map");var headEl;var dummyAnchor;var inlineScriptCount=0;var supportsAccessors=Obj
johan / index.html
Created Nov 25, 2011 — forked from johan/dnd.js
Animated Draggable Spinny Globe
View index.html
<!DOCTYPE html>
<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=""></script>
<script src=""></script>
<link type="text/css" rel="stylesheet" href=""/>
<link type="text/css" rel="stylesheet" href=""/>
<style type="text/css">
View sentence-highlight-word-count-minor-mode.el
;; A minor mode inspired by Gary Provost's notes on making sentence length music
;; via
;; The sentence at point gains its colour from how many words it has:
;; yellow - one or two words
;; pink - three or four words
;; red - five words
;; green - medium sentences
;; blue - long sentences
johan /
Last active Jan 16, 2020 — forked from benelsen/
Earth, night and day sides.
johan /
Last active Jan 16, 2020
Solar Analemmas Anywhere

Hourly solar analemmas (ignoring daylight savings time) as seen from anywhere in the world in 2014.

You can’t perform that action at this time.