Skip to content

Instantly share code, notes, and snippets.

View radar's full-sized avatar

Ryan Bigg radar

View GitHub Profile
@radar
radar / movie.rb
Last active December 26, 2015 04:39 — forked from bluehallu/gist:7094935
xml = params[:upload]
xml = Nokogiri::XML(xml)
xml.xpath('//movie').each do |tag|
movie = Movie.from_tag(tag)
# do what you wish with movie here
end
class RiakWrapper
def self.setup
@client ||= begin
walk_server = WalkServer.first
Riak::Client.new(:protocol => "pbc", :host => walk_server.host, :pb_port => walk_server.pb_port)
end
end
def self.exists?(key, bucket_name)
get_bucket(bucket_name)
@radar
radar / erb.erb
Last active December 25, 2015 13:28 — forked from anonymous/gist:6983396
<%= link_to metric, class: "close", method: :delete, data: { confirm: 'Are you sure?' } do %>
<i class="icon-remove"></i>
<% end %>
<%= link_to [:edit, metric], class: "close" do %>
<i class="icon-pencil"></i>
<% end %>
@radar
radar / gist:6601817
Last active December 23, 2015 07:38
resources :candidates do
collection do
post :prospect
%w(list pending available sent rejected denied prospects hired).each do |route|
get "/#{route}(/:filter)", to: "candidates##{route}"
end
end
end
@radar
radar / gist:6517078
Last active December 22, 2015 18:59
=> "PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SELECT \"pipes\".* FROM \"pipes\" WHERE \"pipes\".\"id\" = $1 ORDER BY \"pipes\".\"id\" ASC LIMIT 1
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:512:in `exec'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:512:in `dealloc'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:501:in `delete'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:792:in `rescue in exec_cache'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:772:in `exec_cache'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:139:in
=> "PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block\n: SELECT \"pipes\".* FROM \"pipes\" WHERE \"pipes\".\"id\" = $1 ORDER BY \"pipes\".\"id\" ASC LIMIT 1\n/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:512:in `exec'\n/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:512:in `dealloc'\n/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:501:in `delete'\n/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:792:in `rescue in exec_cache'\n/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:772:in `exec_cache'\n/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/database_statements.rb

Spree (vs. Magento)

  • Spree does not offer media management as a CMS function

This is true, but we do have some extensions such as spree_static_content that do provide the ability to create extra pages for your site.

  • One page checkout is available on Magento, but not Spree

Assuming you mean the fields are all on one page: This is not provided by default, but it is relatively easy to customize Spree to do this. It's pretty commonly requested, and so it might be a good idea for us to provide a guide on how to do this.

@radar
radar / cache.rb
Last active December 21, 2015 18:39 — forked from anonymous/cache.rb
cache = {
:id => 1,
:pages => [
{
:id => 2,
:redirect => 'whatever',
:designs => {
:id => 3
}
},
@radar
radar / deals_controller.rb
Last active December 21, 2015 17:09 — forked from kmelkon/deal.rb
def status
@deal = Deal.find_by_id(params[:deal_id])
@deal.update_attribute(:state, params[:state])
respond_to do |format|
format.js
end
end
@radar
radar / _deal.html.erb
Last active December 21, 2015 17:09 — forked from kmelkon/_deal.html.erb
<%= form_tag status_deal_path(deal), :remote => true, :class => "deals_status" do %>
<%= radio_button_tag :state, "won", deal.state == "won", :class => "toggle-btn-left toggle-btn", :value =>"won" %>
<%= label_tag 'state_won', "won", :class=>"btn" %>
<%= radio_button_tag :state, "lost", deal.state == 'lost', :class => "toggle-btn-center toggle-btn",:value => "lost" %>
<%= label_tag 'state_lost', "lost",:class=>"btn" %>
<%= radio_button_tag :state, "pending", deal.state == 'pending',:class => "toggle-btn-right toggle-btn", :value => "pending" %>
<%= label_tag 'state_pending', "pending", :class=>"btn" %>
<% end %>