This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Math do | |
def sqrt(x) do | |
refine x, x / 2.0, 1.0 | |
end | |
def refine(target, _, attempt) when attempt * attempt == target do | |
attempt | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RSpec | |
module Mocks | |
module AnyInstance | |
class Recorder | |
def should_recieve(*args) | |
raise NoMethodError.new "should_recieve: Did you mean 'should_receive' ?" | |
end | |
def should_not_recieve(*args) | |
raise NoMethodError.new "should_not_receive: Did you mean 'should_not_receive' ?" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Joshuas-MacBook-Pro:postgresql-node joshua$ npm publish | |
npm ERR! need auth auth and email required for publishing | |
npm ERR! need auth You need to authorize this machine using `npm adduser` | |
npm ERR! System Darwin 12.4.0 | |
npm ERR! command "node" "/usr/local/bin/npm" "publish" | |
npm ERR! cwd /Users/joshua/dev/postgresql-node | |
npm ERR! node -v v0.10.9 | |
npm ERR! npm -v 1.2.24 | |
npm ERR! code ENEEDAUTH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE test ( | |
a_smallint SMALLINT, | |
a_integer INTEGER, | |
a_bigint BIGINT, | |
a_decimal DECIMAL(10,3), | |
a_numeric NUMERIC(10,3), | |
a_real REAL, | |
a_double_precision DOUBLE PRECISION, | |
a_serial SERIAL, | |
a_bigserial BIGSERIAL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
# Returns the index number of a matching element. | |
# The returned element is not guaranteed. | |
# target must implement #<=> | |
# example: | |
# arr = [2,3,5,7,11,13,17,19,23,29] | |
# arr.bsearch_index(2) => 0 | |
# arr.bsearch_index(23) => 8 | |
# arr.bsearch_index(10) => nil | |
# nil always is nil: |
NewerOlder