Skip to content

Instantly share code, notes, and snippets.

@kenglishhi
kenglishhi / xirr.rb
Created January 29, 2012 11:56 — forked from sapient/xirr.rb
XIRR Function Written for Ruby 1.9.2
require 'date'
require 'bigdecimal/newton'
require 'bigdecimal/math'
include Newton
class XIRR
def initialize(datevalues)
@datevalues = datevalues
@zero = BigDecimal::new("0.0")
@kenglishhi
kenglishhi / gist:4043120
Created November 9, 2012 01:21
Failing test shows memoize doesn't memoize a method overridden in a subclas
require 'test_helper'
require 'memoist'
class SubclassBugTest < Test::Unit::TestCase
class Person
extend Memoist
attr_reader :name_calls
def initialize
@kenglishhi
kenglishhi / gist:4044018
Created November 9, 2012 06:13
Install Ruby 2.0.0 preview with rbenv on
$ xcodebuild -version
Xcode 4.5.2
Build version 4G2008a
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.8.2
BuildVersion: 12C60
$ brew install openssl
@kenglishhi
kenglishhi / gist:4253468
Created December 10, 2012 21:12
guard-rake fails when passing args to guard.
[13:05:54] ~/workspace/nulu/Nulu (NULU-802-cute-error-page-prod)$ bundle exec guard -p
13:06:00 - INFO - Guard uses TerminalTitle to send notifications.
13:06:00 - INFO - Guard is now watching at '/Users/kenglish/workspace/nulu/Nulu'
13:06:01 - INFO - Bundle already up-to-date
13:06:01 - INFO - Starting guard-rake routes
rake aborted!
missing argument: -p
<internal:prelude>:10:in `synchronize'
(See full trace by running task with --trace)