Skip to content

Instantly share code, notes, and snippets.

View hxegon's full-sized avatar
🎧
Always Be Coding

Cooper LeBrun hxegon

🎧
Always Be Coding
  • Vaudreuil-Dorion, QC
View GitHub Profile
@hxegon
hxegon / path_finder.py
Created June 17, 2014 07:24
Working on path finding for directional acyclic graphs. Need some help with list comprehension.
import networkx as nx
G = nx.DiGraph()
G.add_nodes_from([ i for i in range(0, 5) ])
G.add_edges_from([(0,1), (0,2), (1, 3), (1, 4)])
class Finder:
def __init__(self, graph):
self.graph = graph
loading ruby /app/vendor/bundle/ruby/2.0.0/gems/spree_core-2.4.5/db/default/spree/countries.rb
loading ruby /app/vendor/bundle/ruby/2.0.0/gems/spree_core-2.4.5/db/default/spree/roles.rb
loading ruby /app/vendor/bundle/ruby/2.0.0/gems/spree_core-2.4.5/db/default/spree/states.rb
rake aborted!
NoMethodError: undefined method `subregions?' for nil:NilClass
/app/vendor/bundle/ruby/2.0.0/gems/spree_core-2.4.5/db/default/spree/states.rb:5:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:46:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:46:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/spree_core-2.4.5/db/default/spree/states.rb:2:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails_12factor'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
GIT
remote: git://github.com/200Creative/spree_bootstrap_frontend.git
revision: d20c03352917ed2d36af11bacb19b88d459450d7
branch: 2-4-stable
specs:
spree_auth_devise_bootstrap (2.4.0)
spree_auth_devise (~> 2.2)
spree_bootstrap
spree_bootstrap (2.4.0)
bootstrap-kaminari-views (~> 0.0.3)
2015-07-07T19:21:30.258737+00:00 app[web.1]: Started PATCH "/checkout/update/address" for 207.154.65.189 at 2015-07-07 19:21:30 +0000
2015-07-07T19:21:30.257628+00:00 app[web.1]: source=rack-timeout id=d1aa70ec-332f-4e39-8034-0d24cce31873 wait=20ms timeout=20000ms state=ready
2015-07-07T19:21:30.274619+00:00 app[web.1]: Processing by Spree::CheckoutController#update as HTML
2015-07-07T19:21:30.274759+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"7oyIVXZXEDscVqZH2CzWOB+l8vbW2kcMX+gOCpFgfxc=", "order"=>{"email"=>"[email protected]", "state_lock_version"=>"8", "bill_address_attributes"=>{"firstname"=>"Cooper", "lastname"=>"LeBrun", "address1"=>"114 Saint Albans Pl.", "address2"=>"", "city"=>"Goleta", "country_id"=>"233", "state_name"=>"California", "zipcode"=>"93117", "phone"=>"8057296901", "id"=>"17"}, "use_billing"=>"1", "ship_address_attributes"=>{"id"=>"18"}}, "commit"=>"Save and Continue", "save_user_address"=>"1", "state"=>"address"}
2015-07-07T19:21:30.656192+00:00 heroku[router]:
2015-07-07T19:30:04.672916+00:00 app[web.1]: source=rack-timeout id=91e1d96e-902d-4650-b2e0-27eb560c9eeb wait=4ms timeout=20000ms state=ready
2015-07-07T19:30:04.705425+00:00 app[web.1]: Processing by Spree::Admin::OrdersController#edit as HTML
2015-07-07T19:30:04.705439+00:00 app[web.1]: Parameters: {"id"=>"R690886836"}
2015-07-07T19:30:04.673436+00:00 app[web.1]: Started GET "/admin/orders/R690886836/edit" for 207.154.65.189 at 2015-07-07 19:30:04 +0000
2015-07-07T19:30:05.713104+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/spree_backend-2.4.5/app/views/spree/admin/shared/_order_summary.html.erb (12.8ms)
2015-07-07T19:30:05.928029+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/spree_backend-2.4.5/app/views/spree/admin/shared/_order_tabs.html.erb (414.1ms)
2015-07-07T19:30:05.927845+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/spree_backend-2.4.5/app/views/spree/admin/shared/_order_submenu.html.erb (57.8ms)
2015-07-07T19:30:05.929059+00:00 app[web.1]: Rendered vend
GIT
remote: git://github.com/spree/spree_auth_devise.git
revision: b554f307e5aa887110a70d54f8967c284f881375
branch: 3-0-stable
specs:
spree_auth_devise (3.0.0)
devise (~> 3.4.1)
devise-encryptable (= 0.1.2)
json
multi_json
def map_product_strings(prod_val, &block)
# product hash -> product hash with strings changed through block
case prod_val
when Hash
Hash[prod_val.map {|key, val| [key, map_product_strings(val, &block)]}]
when Array
prod_val.map { |v| map_product_strings(v, &block) }
when String
@hxegon
hxegon / example_stub_problem.rb
Created December 8, 2015 19:46
Having some trouble testing module instance method behavior.
module Foo
def bar
"#{to_s} whizbang"
end
end
describe Foo do
describe "#bar" do
it "works" do
base = Class.new { include Foo }