Write an implementation that returns the correct results given an array in parsed RPN
[9] #=> 9
[9,1,'+'] #=> 10
[9,1,'+',5,'+'] #=> 15
[3, 5, '+', 7, 6, '+', '/'] #=> 0.6153846153846154| [2011-12-17 13:32:49] ERROR NoMethodError: undefined method `debug_rjs=' for ActionView::Base:Class | |
| /Users/schneems/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-7bde2e2578ea/actionpack/lib/action_view/railtie.rb:34:in `block (3 levels) in <class:Railtie>' | |
| /Users/schneems/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-7bde2e2578ea/actionpack/lib/action_view/railtie.rb:33:in `each' | |
| /Users/schneems/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-7bde2e2578ea/actionpack/lib/action_view/railtie.rb:33:in `block (2 levels) in <class:Railtie>' | |
| /Users/schneems/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-7bde2e2578ea/activesupport/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' | |
| /Users/schneems/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-7bde2e2578ea/activesupport/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' | |
| /Users/schneems/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-7bde2e2578ea/activesupport/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' | |
| /Users/schneems/.rvm/gems/r |
| source 'http://rubygems.org' | |
| gem 'rails', :git => '/Users/schneems/documents/projects/rails' | |
| gem 'journey', :git => 'git://github.com/rails/journey.git' | |
| gem 'arel', :git => 'git://github.com/rails/arel.git' | |
| gem 'sqlite3' | |
| # DelayedLog Goals: decouple logging and sending logs, keep controllers Dry | |
| # Example | |
| # ======= | |
| ## Define how LogWrapper writes to logs | |
| # DelayedLog.on_send do |options| | |
| # | |
| # end | |
| ## Build a log to send |
| _____ | |
| < yay > | |
| ----- | |
| \ ^__^ | |
| \ (oo)\_______ | |
| (__)\ )\/\ | |
| ||----w | | |
| || || |
| # Cut will do the trick | |
| # to grab caracters 2 to 3 we can use | |
| # `cut -c 2-3 | |
| echo 'hello' | cut -c 2-3 | |
| 'el' | |
| cat my-file-name.txt | cut -c 100000-101000 | |
| # output |
| include Devise::TestHelpers | |
| # gives us the login_as(@user) method when request object is not present | |
| include Warden::Test::Helpers | |
| Warden.test_mode! | |
| # Will run the given code as the user passed in | |
| def as_user(user=nil, &block) | |
| current_user = user || Factory.create(:user) | |
| if request.present? |
| let(:user) { Factory.create(:user) } | |
| # To use the methods you can call | |
| # methods directly on them like this: | |
| scenario 'works while logged in' do | |
| as_user(user).visit teach_path | |
| # ... | |
| # Or you can pass the code you wish |
| { | |
| 'previous': '/users?page=1', | |
| 'next': '/users?page=3', | |
| 'users': [ {...} ] | |
| } |
| def handle_gzip_params | |
| # When the server receives a request with content-type "gzip/json" this will be called which will unzip it, | |
| # and then parse it as json | |
| # The use case is so clients such as Android or Iphone can zip their long request such as Inviters#addressbook emails | |
| # Then the server can unpack the request and parse the parameters as normal. | |
| if request.content_type == "gzip/json" | |
| data = ActiveSupport::JSON.decode(ActiveSupport::Gzip.decompress(request.raw_post)) | |
| data = {:_json => data} unless data.is_a?(Hash) | |
| params ||= {} |
Write an implementation that returns the correct results given an array in parsed RPN
[9] #=> 9
[9,1,'+'] #=> 10
[9,1,'+',5,'+'] #=> 15
[3, 5, '+', 7, 6, '+', '/'] #=> 0.6153846153846154