Skip to content

Instantly share code, notes, and snippets.

View agirlnamedsophia's full-sized avatar

Sophia Russell agirlnamedsophia

View GitHub Profile
@agirlnamedsophia
agirlnamedsophia / parambling
Created February 21, 2014 15:29
friday is csv day
respond_to do |format|
format.html
format.csv {
send_data Spree::Order.order_report_csv(@search, created_at_gt, created_at_lt),
type: 'text/csv; charset=iso-8859-1; header=present',
disposition: "attachment; filename=customer-order-report.csv"
}
end
@agirlnamedsophia
agirlnamedsophia / en.yml
Created March 4, 2014 14:53
Example english translation file
en:
locale_name: 'English'
ck:
menu:
calendar: Calendar
categories: 'Categories'
close: Close
close_and_refresh: Close and refresh
comics_az: 'Comics A-Z'
email: Email
@mixin font-face($name, $url) {
font-family:$name;
src:url($url+'.eot?') format('eot'),
url($url+'.woff') format('woff'),
url($url+'.ttf') format('truetype'),
url($url+'.svg') format('svg');
font-weight:normal;
font-style:normal;
}
@agirlnamedsophia
agirlnamedsophia / gist:9536709
Created March 13, 2014 20:48
argh! widgetry
the problem: i cannot update category translations. the error goes back to https://github.com/globalize/globalize/blob/3-1-stable/lib/globalize/active_record/instance_methods.rb#L177-L187.
what is confusing to me is that it works for pages.
pages controller: https://bitbucket.org/blenderbox/comics-kingdom/src/7e23cb5d03972dd04a6432a1420dbbdde6be7a16/app/controllers/admin/pages_controller.rb?at=locale
category controller: https://bitbucket.org/blenderbox/comics-kingdom/src/7e23cb5d03972dd04a6432a1420dbbdde6be7a16/app/controllers/admin/categories_controller.rb?at=locale
page model: https://bitbucket.org/blenderbox/comics-kingdom/src/7e23cb5d03972dd04a6432a1420dbbdde6be7a16/app/models/page.rb?at=locale
American Express Test Card 370000000000002
Discover Test Card 6011000000000012
Visa Test Card 4007000000027
Second Visa Test Card 4012888818888
JCB 3088000000000017
Diners Club/ Carte Blanche 38000000000006
@agirlnamedsophia
agirlnamedsophia / gist:9813261
Created March 27, 2014 17:32
why is the first order fucking up EVERYTHING
Spree::Order Load (3.3ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."number" = 'R10110'
=> [#
<Spree::Order
id: 10110,
number: "R10110",
item_total: #<BigDecimal:7ff120b8fba0,'0.0',9(18)>,
total: #<BigDecimal:7ff120b8fa38,'0.0',9(18)>,
state: "cart",
adjustment_total: #<BigDecimal:7ff120b8f880,'0.0',9(18)>,
user_id: nil,
--- using frameworks at /System/Library/Frameworks
building 'PIL._imaging' extension
creating build/temp.macosx-10.9-intel-2.7
creating build/temp.macosx-10.9-intel-2.7/libImaging
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -I/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/Cellar/freetype/2.5.0.1/include/freetype2 -I/Users/sophiarussell/.virtualenvs/silverstein/build/pillow/libImaging -I/Users/sophiarussell/.virtualenvs/silverstein/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.9-intel-2.7/_imaging.o
--- using frameworks at /System/Library/Frameworks
building 'PIL._imaging' extension
creating build/temp.macosx-10.9-intel-2.7
creating build/temp.macosx-10.9-intel-2.7/libImaging
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -I/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/Cellar/freetype/2.5.0.1/include/freetype2 -I/Users/sophiarussell/.virtualenvs/silverstein/build/pillow/libImaging -I/Users/sophiarussell/.virtualenvs/silverstein/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.9-intel-2.7/_imaging.o
(0.1ms) BEGIN
Spree::Payment Load (0.4ms) SELECT "spree_payments".* FROM "spree_payments" WHERE "spree_payments"."order_id" = 8338 AND "spree_payments"."state" = 'completed'
Spree::LineItem Load (0.4ms) SELECT "spree_line_items".* FROM "spree_line_items" WHERE "spree_line_items"."order_id" = 8338 ORDER BY created_at ASC
Spree::Adjustment Load (0.4ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_id" = 8338 AND "spree_adjustments"."adjustable_type" = 'Spree::Order' AND "spree_adjustments"."eligible" = 't' ORDER BY created_at ASC
(0.3ms) SELECT COUNT(*) FROM "spree_payments" WHERE "spree_payments"."order_id" = 8338
Spree::Payment Load (0.3ms) SELECT "spree_payments".* FROM "spree_payments" WHERE "spree_payments"."order_id" = 8338
Spree::PaymentMethod Load (0.3ms) SELECT "spree_payment_methods".* FROM "spree_payment_methods" WHERE "spree_payment_methods"."deleted_at" IS NULL AND "spree_payment_methods"."id" = 14 AND ("spree_payment_methods".del
def separate_order_address
if self.user_id.present?
u = self.user
# Let's look to see if it's sharing the billing address with the user
if !u.bill_address.blank? &&
(self.bill_address_id.blank? || self.bill_address_id == u.bill_address_id)
new_address = u.bill_address.dup