Skip to content

Instantly share code, notes, and snippets.

@mjhoy
mjhoy / ColladaLoader.js
Last active December 15, 2015 23:28
MHWW Bed
/**
* @author Tim Knip / http://www.floorplanner.com/ / tim at floorplanner.com
*/
THREE.ColladaLoader = function () {
var COLLADA = null;
var scene = null;
var daeScene;
@mjhoy
mjhoy / README.md
Last active December 16, 2015 00:29
Northeast Quadrant

“Northeast quadrant” appears to usually refer to a section of Washington, D.C. Here I mean the northeastern part of the contiguous U.S. (if one were to fold of map of it in half twice, the upper-right part, more or less).

This was generated using data from NASA’s [Shuttle Radar Topography Mission][srtm]. The actual tiles come from [CGIAR-SCI][cgiar]. I used gdalwarp to reproject and combine the tiles:

gdalwarp \
@mjhoy
mjhoy / README.md
Last active December 16, 2015 00:48
Lake Superior

Shown is Lake Superior and the surrounding terrain, using data from NASA’s Shuttle Radar Topography Mission and [bathymetry data from NOAA][noaa].

The two images are layered using a clipping path of the lake, from Natural Earth’s 10m vector lake dataset.

Hill relief, as usual, was generated using the gdal utility suite.

@mjhoy
mjhoy / maybe.rb
Last active December 22, 2015 20:28
an attempt at the maybe monad in Ruby
module Maybe
# Convenience methods
#
def Just(val)
Just.new(val)
end
def Nothing
Nothing.new
@mjhoy
mjhoy / parse_ipv4.hs
Created September 29, 2013 11:59
parsing ipv4, not allowing leading 0s
import Text.ParserCombinators.Parsec
import Control.Monad (liftM2)
-- helper function
manyNtoM :: Int -> Int -> GenParser a b c -> GenParser a b [c]
manyNtoM n m p
| n < 0 = return []
| n > m = return []
| n == m = count n p
| n == 0 = foldr (<|>) (return []) (map (\x -> try $ count x p) (reverse [1..m]))
@mjhoy
mjhoy / gist:8044449
Last active December 31, 2015 21:09
bicycles

Faisal bin Turki brought a newspaper to the desk.

"Boulenger, listen to this.

"It says here that an Englishman, Thomas Stevens, has circled the world on a bicycle. Did you hear me, Boulenger? A bicycle! Of course, he had to walk through Wyoming. And he took a steamer from Calcutta to China."

Boulenger nodded. "Not surprising, Faisal! C'est l'exception qui confirme la régle. Most geckos can't fly, after all.

"Now, Faisal, help me with my Christmas card. What should I write?"

@mjhoy
mjhoy / gist:8044923
Last active December 31, 2015 21:09
coffee

Faisal bin Turki sipped from his cup.

"Ah! Boulenger, you must try this! It's like your coffee, but with cardamom and clove. It beats anything you can get in Belgium."

Boulenger tapped his pen. "No hot drinks for me, Faisal! Celui que est lent à manger est lent à travailler. Geckos like to eat their insects in one bite.

"And Faisal, could you help with this Christmas card? I can't think of what to write!"

But Faisal was dreaming of a tree adorned with snow and pink flowers.

@mjhoy
mjhoy / gist:8049885
Last active December 31, 2015 21:49
dom pedro II

Faisal bin Turki prodded the fire with an iron.

"Boulenger, tell me this. If a king is universally acknowledged an excellent statesman, but is eagerly overythown by his own people, is he really all that good?"

Boulenger chuckled. "Faisal, you are thinking of my friend Dom Pedro II."

"Yes."

@mjhoy
mjhoy / gist:8056045
Created December 20, 2013 15:07
dhows

Faisal bin Turki looked out over the Gulf.

"Boulenger, have you seen anything like our dhows sailing in the evening? I know of a carpenter here who builds them purely from his head. He does not measure. You only tell him it must have a capacity for so-and-so many packages of dates. Yet his are the most beautiful!"

Boulenger was scribbling. "Nature passe nourriture. Faisal, if I told you a lizard was 2.75 inches from snout to vent, with no fifth

[mjhoy@mjh-air-2 client]$ pulp server
* Server listening on http://localhost:1337/
* Invalid option `--require-path=../'
Usage: psc [FILE] [-o|--output ARG] [--no-tco] [--no-magic-do] [--no-opts]
[-v|--verbose-errors] [-c|--comments] [--source-maps] [--dump-corefn]
[-p|--no-prefix] [--json-errors]
Hash: 3ef54b8f9609f9e9c044