Skip to content

Instantly share code, notes, and snippets.

View mieko's full-sized avatar

Mike Owens mieko

View GitHub Profile
@mieko
mieko / chronic_scan.rb
Created May 16, 2011 04:20
Scan free-form text for human-reabible dates (according to Chronic)
require 'chronic'
module Chronic
class << self
def scan(text)
return enum_for(:scan, text) unless block_given?
# words is lossless. We need to be able to join('') this and get
# the original string back
words = scan_by_re(text, /\s+/).to_a
# Extracted from the following library
# http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/
#--
# Utility for creating Google Maps Encoded GPolylines
# License: You may distribute this code under the same terms as Ruby itself
# Author: Joel Rosenberg
class DouglasPeucker
# The minimum distance from the line that a point must exceed to avoid
# elimination under the DP Algorithm.