Skip to content

Instantly share code, notes, and snippets.

View mdunsmuir's full-sized avatar

Michael Dunsmuir mdunsmuir

  • Seattle
View GitHub Profile
@mdunsmuir
mdunsmuir / find_neighbors_hash.rb
Created May 6, 2013 22:14
Hash subclass for Numeric keys only, returns either the actual value for an existing key, the values for the lower and upper *bounding* keys respectively for a bounded unknown key, or the value for the greatest or smallest existing key in the case of an out-of-bounds unknown key.
#
# This subclass of Hash is designed to search for the values associated
# with the two nearest Numeric keys to a given "key" argument *not*
# a member of the FindNeighborsHash, or the *single* value associated with
# an *existing* key.
#
class FindNeighborsHash < Hash
def []=(key, val)
raise ArgumentE
filetype indent on " automatically indent
set expandtab " tabs are spaces
set shiftwidth=2 " two space indent
set tabstop=2
set ruler " display line number and position
"This unsets the "last search pattern" register by hitting return
nnoremap <CR> :noh<CR><CR>