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
Show hidden characters
| "include_users": false, | |
| // "include_users": ["user1", "user2"], | |
| // Show the authors of Gists | |
| "show_authors": false, | |
| // Proxy server | |
| // Format: "http://user:pass@proxy:port" | |
| "https_proxy": "", |
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
| require 'benchmark' | |
| result = Benchmark.measure do | |
| "a"*1_000_000_000 | |
| end | |
| puts result.total |
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
| require 'active_support/concern' | |
| module MyModule | |
| def my_val | |
| @my_val ||= 2 | |
| end | |
| # def self.included(receiver) | |
| # receiver.instance_variable_set('@my_val',2) |
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
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpC35S4+PUe8vbraqdRX76aQq8+yhumx7EdQlAaoPUJwqrX/EaY1SBJnkIRczQEpMcxCl66kIpWV1PywIm8zlaVAbUj9xwdtlcG5dHn6hBtpzWBY1B3PbN4nsO/cXOx5yJn0beqo71iJDKq9YRkmQlLU6qEeEx0CRNR/ulx9XsFqOx8tB/5idkQ5algxDLhnyOojKsEWkByr7NOJLNaeeOjm5ivsIzsK7mL+WQPzeJhi2t6q0UWb44YdVTT7GJD9isRNpAnhC19rK6Oj3MD4EEppMGN6inMpZuPhpeIECsAv6Ahc86Jj7MTrGxBx7E1Kp3EiqU62Y3oskCP99QKnHT |
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
| # total amount of the order, only considering item cost | |
| def amount | |
| self.line_items.map(&:amount).sum | |
| 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
| class Calculator::PriceBucket < Calculator | |
| preference :minimal_amount, :decimal, :default => 0 | |
| preference :normal_amount, :decimal, :default => 0 | |
| preference :discount_amount, :decimal, :default => 0 | |
| def self.description | |
| I18n.t("price_bucket") | |
| end | |
| # as object we always get line items, as calculable we have Coupon, ShippingMethod |
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
| ActionView::Template::Error (undefined method `to_d' for #<Order:0x82cce98>): | |
| 14: <h3>Shipping Method:</h3> | |
| 15: <div class="method"> | |
| 16: <% i = 1 %> | |
| 17: <% @order.rate_hash.each do |shipping_method| %> | |
| 18: <%= radio_button(:order, :shipping_method_id, shipping_method[:id], :class => "radio#{i}", :id => shipping_method[:cost]) %> | |
| 19: <label><%= shipping_method[:name] %> <%= number_to_currency shipping_method[:cost] %></label> | |
| 20: <div class="clear"></div> | |
| app/views/checkout/_payment.html.erb:17:in `_app_views_checkout__payment_html_erb___481978343_67756860_4938188' | |
| app/views/checkout/edit.html.erb:7:in `_app_views_checkout_edit_html_erb__453920959_66761340_0' |
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
| select_tag "people", options_from_collection_for_select(@people, "id", "name"), :prompt => "Select something" | |
| # => <select id="people" name="people"><option value="">Select something</option><option value="1">David</option></select> |
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
| def select_tag(name, option_tags = nil, options = {}) | |
| if Array === option_tags | |
| ActiveSupport::Deprecation.warn 'Passing an array of option_tags to select_tag implicitly joins them without marking them as HTML-safe. Pass option_tags.join.html_safe instead.', caller | |
| end | |
| html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name | |
| if blank = options.delete(:include_blank) | |
| if blank.kind_of?(String) | |
| option_tags = "<option value=\"\">#{blank}</option>".html_safe + option_tags | |
| else |
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
| set :gateway, 'YOUR GATEWAY SERVER IP' | |
| role :web, "web1", "web2" |
NewerOlder