This file contains 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
# Provides the ability to unscope associations, this solves problems described in | |
# http://stackoverflow.com/questions/1540645/how-to-disable-default-scope-for-a-belongs-to/11012633#11012633 | |
# | |
# Examples | |
# | |
# class Document < ActiveRecord::Base | |
# default_scope where(deleted: false) | |
# end | |
# | |
# class Comment < ActiveRecord::Base |
This file contains 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
# cancel shipped order | |
Spree::Order.class_eval do | |
def allow_cancel? | |
true | |
end | |
end | |
Spree::Shipment.class_eval do | |
def after_cancel | |
# do nothing | |
end |
This file contains 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
s = shipment 'H13747660865' | |
p = s.to_package | |
o = s.order | |
#shipping method you want | |
m = Spree::ShippingMethod.find(21) | |
r = m.calculator.compute(p) |
This file contains 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
# Spree 1-3-stable | |
Spree::Order.class_eval do | |
def force_apply_store_credit | |
# store credit can't be greater than order total (not including existing credit), or the user's available credit | |
@store_credit_amount = [user.store_credits_total, (total + store_credit_amount.abs)].min | |
if @store_credit_amount <= 0 | |
adjustments.store_credits.destroy_all | |
else | |
if sca = adjustments.store_credits.first |
This file contains 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
<?xml version='1.0'?> | |
<IntlRateV2Response> | |
<Package ID="0"> | |
<Prohibitions>An issue of a publication in which more than 5 percent of its total advertising space is primarily directed to a Canadian market and which indicates: | |
(a) Specifically where goods or services may be obtained in Canada, or | |
(b) Specific items or conditions relating to the sale or provision of goods or services in Canada. | |
All alcoholic beverages including wines, etc. | |
An issue of a publication that contains an advertisement primarily directed to a Canadian market is a prohibited import if that advertisement does not appear in identical form in all editions of the issue distributed in the country of origin. | |
Articles so marked as to create the false impression that they were made in Canada, Great Britain or any other British country. | |
Commercial tags of metal. |
This file contains 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
[ 2013-07-31 17:37:58.0145 1831/0x100d86000 Pool2/Implementation.cpp:1174 ]: [App 1839 stderr] /usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/transaction_sampler.rb:116: [BUG] Segmentation fault | |
[ 2013-07-31 17:37:58.0145 1831/0x100d86000 Pool2/Implementation.cpp:1174 ]: [App 1839 stderr] ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin11.4.2] | |
[ 2013-07-31 17:37:58.0146 1831/0x100d86000 Pool2/Implementation.cpp:1174 ]: [App 1839 stderr] | |
[ 2013-07-31 17:37:58.0146 1831/0x100d86000 Pool2/Implementation.cpp:1174 ]: [App 1839 stderr] -- Crash Report log information -------------------------------------------- | |
[ 2013-07-31 17:37:58.0146 1831/0x100d86000 Pool2/Implementation.cpp:1174 ]: [App 1839 stderr] See Crash Report log file under the one of following: | |
[ 2013-07-31 17:37:58.0146 1831/0x100d86000 Pool2/Implementation.cpp:1174 ]: [App 1839 stderr] * ~/Library/Logs/CrashReporter | |
[ 2013-07-31 17:37:58.0146 1831/0x100d86000 Pool2/Implementation.cp |
This file contains 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
#!/bin/bash | |
# Favicon and Apple Touch Icon Generator | |
# | |
# This bash script takes an image as a parameter, and uses ImageMagick to convert it to several | |
# other formats used on modern websites. The following copies are generated: | |
# | |
# * apple-touch-icon-144x144-precomposed.png | |
# * apple-touch-icon-114x114-precomposed.png | |
# * apple-touch-icon-57x57-precomposed.png |
This file contains 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 Screengif | |
attr_reader :screencapture, :convert, :tempname, :delay, :times | |
def initialize args | |
@screencapture = '/usr/sbin/screencapture' | |
@convert = '/usr/local/bin/convert' | |
args.each do |k,v| | |
instance_variable_set("@#{k}", v) unless v.nil? | |
end | |
@tempname.gsub!("\n", '') | |
(1..@times).each do |i| |
This file contains 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
#Passenger additional NGINX configure flags for SPDY support | |
--with-pcre --with-ipv6 --with-ld-opt=-L/usr/local/lib --with-http_spdy_module --with-http_gzip_static_module |
This file contains 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
#!/bin/sh | |
# | |
#################################### | |
# iTunes Command Line Control v1.0 | |
# written by David Schlosnagle | |
# created 2001.11.08 | |
#################################### | |
showHelp () { | |
echo "-----------------------------"; |