This file contains 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
On Fri, Dec 7, 2012 at 10:10 AM, tim ruffles <timruffles@googlemail.com> wrote: | |
> Just ignore any mention of Cucumber (unless you're working with the mythical .feature file writing/reading client). | |
I agree that a newbie should ignore cucumber. I teach my pairing clients the same way. | |
But this is a meme that just annoys me, because it's BS. And not only that, the most prominent people repeating it *tend* to be people who are out of touch with client work. (Not referring to you here, but to some of the louder voices behind the "mythical client" meme.) There absolutely are clients who write cucumber, or something very close to cucumber, or who sit with a developer and collaborate to write an English description of their needs which can then serve as an automated acceptance test. | |
But the bigger problem with this meme is that it's a strawman. Cucumber, and the BDD ideas it comes out of, are about *establishing common language among ALL stakeholders*. This may not mean between client and developer. I worked on o |
This file contains 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 Foo | |
def bar | |
"wtf?" | |
end | |
protected :bar | |
def invoke_bar | |
public_send(:bar) | |
end | |
end |
This file contains 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
1.8.7 :001 > proc { |a| p a }.call(1, 2) | |
(irb):1: warning: multiple values for a block parameter (2 for 1) | |
from (irb):1 | |
[1, 2] | |
1.9.3-p286 :001 > proc { |a| p a }.call(1, 2) | |
1 |
This file contains 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 Age | |
def self.for_date_of_birth(dob, today = Date.today) | |
# http://stackoverflow.com/a/11942/445124 | |
diff = today.strftime("%Y%m%d").to_i - dob.strftime("%Y%m%d").to_i | |
diff / 10000 | |
end | |
end |
This file contains 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 Age | |
def self.for_date_of_birth(dob, today = Date.today) | |
# http://stackoverflow.com/a/11942/445124 | |
diff = today.strftime("%Y%m%d").to_i - dob.strftime("%Y%m%d").to_i | |
diff / 10000 | |
end | |
end |
This file contains 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
jruby-1.6.8 :001 > require 'tmpdir' | |
=> true | |
jruby-1.6.8 :002 > Dir.mktmpdir { } | |
Errno::EACCES: Permission denied - /tmp/d20121014-5917-19xh1jk/. | |
from org/jruby/RubyFile.java:478:in `initialize' | |
from org/jruby/RubyIO.java:1135:in `open' | |
from /home/travis/.rvm/rubies/jruby-1.6.8/lib/ruby/1.8/fileutils.rb:699:in `remove_entry_secure' | |
from /home/travis/.rvm/rubies/jruby-1.6.8/lib/ruby/1.8/tmpdir.rb:131:in `mktmpdir' | |
from (irb):2:in `evaluate' | |
from org/jruby/RubyKernel.java:1112:in `eval' |
This file contains 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
1.9.3p194 :001 > 1==1?"one":"not one" | |
=> "one" | |
1.9.3p194 :002 > def one | |
1.9.3p194 :003?> 1 | |
1.9.3p194 :004?> end | |
=> nil | |
1.9.3p194 :005 > 1==one?"one":"not one" | |
SyntaxError: (irb):5: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' | |
1==one?"one":"not one" | |
1.9.3p194 :006 > 1==one ? "one":"not one" |
This file contains 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
1.9.3p194 :010 > :"testing#{10+9}" | |
=> :testing19 | |
1.9.3p194 :011 > objects = ObjectSpace.each_object(String).to_a | |
=> [...] | |
1.9.3p194 :012 > objects.include?("testing19") | |
=> true |
This file contains 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
; me | |
(defn check-sum [sequence] | |
(reduce + (map * (cycle [1 3]) sequence))) | |
; fp-oo | |
(def check-sum | |
(fn [sequence] | |
(apply + (map (fn [position digit] | |
(* digit (if (odd? position) 1 3))) | |
(range 1 (inc (count sequence))) |
This file contains 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
[ruby] irb | |
2.0.0dev :001 > %w(abc def) | |
=> ["abc", "def"] | |
2.0.0dev :002 > %i(abc def) | |
2.0.0dev :003?> |