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
given | |
| date | num | | |
| 01/11/12 | 1 | | |
| 02/11/12 | 1 | | |
| 03/11/12 | 3 | | |
| 04/11/12 | 3 | | |
| 05/11/12 | 3 | | |
| 06/11/12 | 3 | | |
| 07/11/12 | 4 | |
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
has_one :latest_successful_audit_factor_change, | |
class_name: "AuditFactorChange", | |
primary_key: "san", | |
foreign_key: "san", | |
conditions: {status: "Complete"}, | |
order: "finished_at DESC" |
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 :012 > ActiveSupport::TimeZone["America/New_York"] | |
=> (GMT-05:00) America/New_York | |
1.9.3p194 :013 > DateTime.now.utc | |
=> Wed, 31 Oct 2012 16:15:11 +0000 | |
1.9.3p194 :014 > ActiveSupport::TimeZone["America/New_York"].utc_to_local(DateTime.now.utc) | |
=> Wed, 31 Oct 2012 12:15:18 +0000 | |
1.9.3p194 :015 > |
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
I would have thought that regular WTF readers would have grown out of the "language x is bad" mentality. There are few bad languages but many bad programmers. There's little correlation between the two. Apart from PHP. |
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 Array | |
def expand_ranges | |
self.collect { |wtf| wtf.is_a?(Range) ? wtf.to_a : wtf }.flatten | |
end | |
end | |
[1..15, 19, 21..25].expand_ranges.each { |i| puts i } |
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
require "spec_helper" | |
describe Formulae do | |
it "should do some stuff.." do | |
nmpf = Formulae.new "days / 273.93", days: 420 | |
aobf = Formulae.new "breedfactor * trimsters", breedfactor: 1.10, trimsters: nmpf | |
ccf = Formulae.new "cats * breeding", cats: 2, breeding: aobf | |
f = Formulae.new "10 * catcount", catcount: ccf |
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
<clocKwize> vectorshelve, your cucumber tests should be from a users point of view, so write "Then the user should see a sucessful message in their current locale" and the step for that be page.should have_content i18n.get(arg1, @user.locale) or something | |
* stantona has quit (Ping timeout: 268 seconds) | |
<clocKwize> arg1 should actually be :feedback_sucess_message or something whatever | |
* CrazyHorse18 has quit (Quit: Leaving.) | |
* sideshow1oder (~phil@ppp-88-217-34-120.dynamic.mnet-online.de) has joined #RubyOnRails | |
* vectorshelve_ (75c126a0@gateway/web/freenode/ip.117.193.38.160) has joined #RubyOnRails | |
<clocKwize> otherwise the implementation details a user doesn't cares about are visible in a user centric test. would your user say "Then I should see a sucessful message" or "Then i should see t(feedback_sucessful)" |
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
global_client_stats $ rake routes | |
root / application#root | |
/resque #<struct Sinatra::ExtendedRack app=#<Sinatra::ShowExceptions:0x00000005b3ddf0 @app=#<Rack::Head:0x00000005b3de18 @app=#<Rack::NullLogger:0x00000005b3de40 @app=#<Rack::Protection::FrameOptions:0x00000005b3df08 @app=#<Rack::Protection::IPSpoofing:0x00000005b3df80 @app=#<Rack::Protection::JsonCsrf:0x00000005b3dff8 @app=#<Rack::Protection::PathTraversal:0x00000005b3e070 @app=#<Rack::Protection::XSSHeader:0x00000005b3e110 @app=#<Resque::Server:0x00000005b3e570 @default_layout=:layout, @app=nil, @template_cache=#<Tilt::Cache:0x00000005b3e548 @cache={}>>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :except=>[:session_hijacking, :remote_token]}>, @op |
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
namespace :db do | |
desc "Rolls the schema back to the previous version. Specify the number of steps with STEP=n" | |
task :rollback => :environment do | |
step = ENV['STEP'] ? ENV['STEP'].to_i : 1 | |
version = ActiveRecord::Migrator.current_version - step | |
ActiveRecord::Migrator.migrate('db/migrate/', version) | |
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
tag_method_map = {"string" => :text_field_tag, "text" => :text_area_tag, "integer" => :number_field_tag} | |
tag_method = tag_method_map[options[:type]] | |
input = @template.send(tag_method, options[:name], "", :class => options[:input_class], :required => options[:required] ? "required" : nil) |