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
| filename = "a.b c.a" | |
| parts = filename.split(".") | |
| last_index_of_space = parts.index(parts.grep(/ /).last) | |
| suffix = parts[last_index_of_space + 1..-1] | |
| prefix = parts[0..last_index_of_space].join(".") | |
| p [prefix, suffix] |
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 CommentsHelper | |
| def putstree(text,hash,depth,trusted) | |
| hash.each_pair do |k,v| | |
| text << (render :partial => "shared/comment", :locals => {:trusted => trusted, :comment => k, :depth => depth}) | |
| if v != {} | |
| putstree(text,v,depth+1,trusted) | |
| end | |
| end | |
| if depth == 0 | |
| text |
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
| <table> | |
| <% @contractors.each do |contractor| %> | |
| <tr> | |
| <td><%= contractor.firstname %></td> | |
| <td> | |
| <%= button_to("Add", add_contractor_quote_path(@quote, :contractor_id => contractor.id)) %> | |
| </td> | |
| </tr> | |
| <% end %> | |
| </table> |
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
| <% @orders.each do |order| %> | |
| <% if order.authorized %> | |
| <tr class="order_authorized"> | |
| <% else %> | |
| <tr> | |
| <% end %> | |
| <td><%= link_to order.user.email, user_path(order.user) %></td> | |
| <td><%= link_to order.id, order_path(order) %></td> | |
| <td><%= order.created_at.strftime("%d %B %Y") %></td> | |
| <td><%= number_to_currency(order.line_items.sum(:price), :unit => "€") %></td> |
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 OtoplastikCustomer < Customer | |
| def otoplastik? | |
| true | |
| end | |
| def find_prices(article_id, merchant_id) | |
| OtoplastikArticlePrice.where("otoplastik_article_id = ? AND merchant_code = ?", article.id, self.id).order("minimum DESC") | |
| end | |
| def prices(article) |
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 id="membership_id" name="membership[id]"><option value="IG">Inspector General (CO) (LTC)</option> | |
| <option value="IG">Inspector General (CO) (LTC)</option> | |
| <option value="NU2013">Class of 2013 (STU)</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
| Conversation.where("(user_id = :current_user OR user_id = :other_user) AND (recipient_id = :current_user OR recipient_id = :other_user)", :current_user => current_user.id, :other_user => user.id) |
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 'spec_helper' | |
| describe "Session" do | |
| describe "GET /auth/facebook and /session/create (same as /auth/facebook/callback)" do | |
| it "triggers callback, creates Bob and redirects to root" do | |
| User.count.should == 0 | |
| Login.count.should == 0 | |
| get '/auth/facebook' | |
| User.count.should == 1 | |
| Login.count.should == 1 |
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
| #app/views/users/edit.html.erb | |
| ... | |
| <%= content_tag(:label, :class => 'add-on') { 'ft.' } %> |
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
| # When I run the test when Redis is running, all tests pass | |
| # When I run the test with Redis purposefully off, I get the error at the end of the gist | |
| # | |
| # I've tried manually raising Redis::CannotConnectError instead of calling Redis.new | |
| # and a new instance of SimpleStore is returned, and again all tests pass | |
| # Gemfile | |
| gem 'redis', '~> 3.0.0' |