Skip to content

Instantly share code, notes, and snippets.

@jsqu99
jsqu99 / address.html hack
Created February 14, 2011 18:11
address without countries
complete contents of checkout/_address.html.erb (w/ hardcoded states/ids...be careful):
<style>
div.inner input[type=text], div.inner select { width: 80%; }
.hidden { display: none; }
</style>
<fieldset id='billing'>
<%= form.fields_for :bill_address do |bill_form| %>
<legend><%= t("billing_address")%></legend>
<div class="inner">
@jsqu99
jsqu99 / gist:1659271
Created January 22, 2012 23:14 — forked from Gregg/gist:968534
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
mysql> select * from spree_calculators where calculable_type = 'ShippingMethod';
+------+--------------------------------------+---------------+-----------------+---------------------+---------------------+----------+
| id | type | calculable_id | calculable_type | created_at | updated_at | advanced |
+------+--------------------------------------+---------------+-----------------+---------------------+---------------------+----------+
| 83 | Calculator::Shipping | 1 | ShippingMethod | 2011-04-26 22:44:39 | 2011-04-26 22:44:39 | 0 |
| 84 | Calculator::Fedex::StandardOvernight | 2 | ShippingMethod | 2011-04-29 20:29:13 | 2011-04-29 20:29:13 | 0 |
| 85 | Calculator::FlatRate | 3 | ShippingMethod | 2011-06-22 18:46:33 | 2011-06-22 18:46:33 | 0 |
| 4029 | Calculator::FedEx | 4 | ShippingMethod | 2011-12-08 17:47:46 | 2011-12-08 17:47:
mysql> select * from spree_calculators where calculable_type = 'Spree::ShippingMethod';
+------+---------------------------------------------+---------------+-----------------------+---------------------+---------------------+----------+
| id | type | calculable_id | calculable_type | created_at | updated_at | advanced |
+------+---------------------------------------------+---------------+-----------------------+---------------------+---------------------+----------+
| 83 | Spree::Calculator::Shipping | 1 | Spree::ShippingMethod | 2011-04-26 22:44:39 | 2011-04-26 22:44:39 | 0 |
| 84 | Spree::Calculator::Fedex::StandardOvernight | 2 | Spree::ShippingMethod | 2011-04-29 20:29:13 | 2011-04-29 20:29:13 | 0 |
| 85 | Spree::Calculator::FlatRate | 3 | Spree::ShippingMethod | 2011-06-22 18:46:33 | 2011-06-22 18:46:33 | 0 |
| 4029 | Spree::Calculator::Fedex
@jsqu99
jsqu99 / packages_override_for_spree_active_shipping.rb
Created June 22, 2012 16:08
packages override for spree_active_shipping
# Override to exclude products with ships_free
def packages(order, line_items)
return nil if line_items.empty?
candidate_line_items = line_items - order.line_items_that_ship_free # never consider the free
# so if we have only ships_free products, actually let the items slip through so we can compute a real value
# we do this b/c we'll automatically provide a 'free shipping' option, and we'll also want to provide the 'non-free' options
# as well, per Chris' request.
<%= javascript_tag do %>
function activate_<%= proof_file.object_id %>() {
// set the 'master' and 'preview' images to be cropped
$('#cropbox').attr('src', '<%= proof_file.large.url %>');
$('#preview').attr('src', '<%= proof_file.large.url %>');
<% preview_width, preview_height = proof_file.large.get_version_dimensions %>
<% original_width, original_height = proof_file.original.get_version_dimensions %>
with(:price, Range.new(price.split('-').first, price.split('-').last)) if price
# see https://github.com/sunspot/sunspot#readme for a good explanation of using 'row' with facets
facet(:price) do
PRODUCT_PRICE_RANGES.each do |range|
row(range) do
Rails.logger.debug("adding price facet w/ range: #{range.split('-').first}, #{range.split('-').last}")
with(:price, Range.new(range.split('-').first, range.split('-').last))
end
end
locations = CampLocation.unscoped.where("name like '%ustin%'")
location_option_values = []
locations.each do |location|
begin
location_option_values << Spree::OptionValue.unscoped.find(location.location_option_value_id)
rescue => error
puts "trouble with location: #{location.id} - #{location.name} - #{error}"
end
end
~/src/landlord/spec/dummy$: RAILS_ENV=production bundle exec rake --trace assets:precompile:primary
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
~/src/genosha$: be cap prestaging deploy
triggering load callbacks
* 2013-06-03 19:41:23 executing `prestaging'
triggering start callbacks for `deploy'
* 2013-06-03 19:41:23 executing `multistage:ensure'
* 2013-06-03 19:41:23 executing `deploy'
* 2013-06-03 19:41:23 executing `deploy:update'
** transaction: start
* 2013-06-03 19:41:23 executing `deploy:update_code'
updating the cached checkout on all servers