Skip to content

Instantly share code, notes, and snippets.

View mhkeller's full-sized avatar

Michael Keller mhkeller

View GitHub Profile
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@mhkeller
mhkeller / README.md
Created October 13, 2014 17:29 — forked from bitinn/README.md

A soft-fullscreen prompt for iOS7+

Background

iOS 7.0 and iOS 8 (Beta) do not have support for minimal-ui viewport keyword, nor do they response to window.slideTo(0,1) or support Fullscreen API, which means there is no easy way to tell Mobile Safari to hide address bar/menu without user interaction.

This is a problem for Web App that mimics Native App design, where html/body are commonly set to height: 100%, so browser viewport = available screen estate. There are currently no solution besides adding apple-mobile-web-app-capable meta and ask users to manually Save to Homescreen.

@mhkeller
mhkeller / README.md
Last active August 29, 2015 14:18 — forked from aubergene/README.md
A packaged version of aubergene's Scale (https://gist.github.com/aubergene/7791133)

I love D3's Quantitative Scales and wanted a simple way to create and use scales in that style.

Example

var centigradeToFahrenheit = new Sideburns(-40, 0, -40, 32);

centigradeToFahrenheit(35); // 95 hot!
centigradeToFahrenheit.inverse(14); // -10 cold!
@mhkeller
mhkeller / README.md
Created June 3, 2016 21:34 — forked from mdml/README.md
D3 Stacked Area Chart Example
@mhkeller
mhkeller / README.md
Created November 18, 2018 18:22 — forked from jstcki/README.md
Polylinear Time Scale

When creating a polylinear time scale, the tricky part is to know to which value in the range the intermediate dates should map.

Let's say we want to "zoom in" on 4 particular days and make them appear with the size of 10 days each. Because these days now take up more space (36 or (factor - 1) * n), we need to create a linear time scale where the domain ends at 36 days later than we want to show. This scale is then used to determine the intermediary range values of the polylinear scale.

@mhkeller
mhkeller / mv.sh
Created April 13, 2020 22:46 — forked from premek/mv.sh
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
function mv() {
if [ "$#" -ne 1 ]; then
command mv "$@"
return
@mhkeller
mhkeller / .block
Created February 24, 2021 05:04 — forked from syntagmatic/.block
d3-hierarchy tree
license: gpl-3.0
border: no
height: 500