Skip to content

Instantly share code, notes, and snippets.

View mieko's full-sized avatar

Mike Owens mieko

View GitHub Profile
@mieko
mieko / CCTableView.cpp
Created September 11, 2012 09:00
CCTableView with variable-size cells
/****************************************************************************
Copyright (c) 2012 cocos2d-x.org
Copyright (c) 2012 Mike Owens <mike@filespanker>
Copyright (c) 2010 Sangwoo Im
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@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.