This file has been truncated, but you can view the full file.
This file contains hidden or 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
//------------------------------------------------------------------------------ | |
// <auto-generated> | |
// This code was generated by a tool. | |
// Runtime Version:6.0.36 | |
// | |
// Changes to this file may cause incorrect behavior and will be lost if | |
// the code is regenerated. | |
// </auto-generated> | |
//------------------------------------------------------------------------------ |
This file contains hidden or 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
{ | |
"acknowledgedWarnings": [ | |
"string" | |
], | |
"listing": { | |
"core": { | |
"uid": "string", | |
"cumulativeDaysOnMarket": 0, | |
"daysOnMarket": 0, | |
"previousStandardStatus": "string", |
This file contains hidden or 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
module Middleware | |
class VersionEndpoint | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
# Return the latest git-sha in ENV if the request is exactly the version endpoint. | |
if env['PATH_INFO'] == '/version' | |
if version = source_version |
This file contains hidden or 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
# PROBLEM: | |
# Given a singley linked list, reverse the list. | |
# | |
# SOLUTION: | |
# Nothing to tricky other to keep track of all the pointers when iterating through. | |
# Basic object to represent a linked list. | |
class Node | |
attr_accessor :next | |
attr_accessor :value |
This file contains hidden or 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
# PROBLEM | |
# Find an implementation of "x" that will force the code below to print "helloworld". | |
# SOLUTION | |
# This doesn't work with threads forked to return true/false. The trick is to just have x do both. | |
def x | |
print "hello" | |
false | |
end |
This file contains hidden or 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
## | |
# This is spree 2-1-stable specific logic to re-apply a promotion code. It will not work for 2-2-stable because promotions are being revamped. | |
# https://github.com/spree/spree/issues/4398 | |
# | |
def reapply_coupon_codes | |
codes = [] | |
# Go through the adjustments to find promotions that are not eligible | |
adjustments.each do |a| | |
if a.eligible == false && a.originator.respond_to?(:promotion) && a.originator.promotion.code |
This file contains hidden or 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
source 'https://rubygems.org' | |
############################# | |
# Environment-agnostic gems # | |
############################# | |
gem 'rails', '4.0.0' | |
gem 'rack-cors', :require => 'rack/cors' # cross-domain request support for rack | |
gem 'pg' # postgres database client | |
gem 'sass-rails', '~> 4.0.0' # Use SCSS for stylesheets |
This file contains hidden or 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
def product_scope | |
variants_associations = [{ option_values: :option_type }, {images_for_variant: {variant_images: :image}}, :default_price, :prices, :images, { variant_description: :description }] | |
if current_api_user.has_spree_role?("admin") | |
scope = Spree::Product.with_deleted.accessible_by(current_ability, :read) | |
.includes(:product_properties, {:option_types => :option_values}, variants: variants_associations, master: variants_associations) | |
unless params[:show_deleted] | |
scope = scope.not_deleted | |
end | |
else |
This file contains hidden or 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
Started GET "/api/products/the-skinny" for 127.0.0.1 at 2014-02-03 12:17:41 -0500 | |
Spree::User Load (0.6ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."id" IS NULL LIMIT 1 | |
Token sign-in failed with nil | |
Spree::Product Load (1.1ms) SELECT "spree_products".* FROM "spree_products" INNER JOIN "spree_variants" ON "spree_variants"."product_id" = "spree_products"."id" AND "spree_variants"."is_master" = 't' INNER JOIN "spree_prices" ON "spree_prices"."variant_id" = "spree_variants"."id" WHERE "spree_products"."deleted_at" IS NULL AND "spree_products"."permalink" = 'the-skinny' AND ("spree_products".deleted_at IS NULL or "spree_products".deleted_at >= '2014-02-03 17:17:41.434945') AND ("spree_products".available_on <= '2014-02-03 17:17:41.435128') LIMIT 1 | |
Spree::ProductProperty Load (0.5ms) SELECT "spree_product_properties".* FROM "spree_product_properties" WHERE "spree_product_properties"."product_id" IN (5) ORDER BY spree_product_properties.position | |
Spree::ProductOptionType Load (0.3ms) |
This file contains hidden or 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
Started GET "/api/products/awesome-pants" for 127.0.0.1 at 2014-02-03 09:27:15 -0500 | |
Spree::User Load (0.6ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."spree_api_key" = '6ba5d874b7c63fe8a74bb44ad658f3052a4a1148bd83a5f3' LIMIT 1 | |
(0.5ms) SELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1 AND "spree_roles"."name" = 'admin' [["user_id", 1]] | |
CACHE (0.0ms) SELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1 AND "spree_roles"."name" = 'admin' [["user_id", 1]] | |
Spree::Product Load (0.6ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."slug" = 'awesome-pants' AND ("spree_products".deleted_at IS NULL or "spree_products".deleted_at >= '2014-02-03 14:27:15.814917') ORDER BY "spree_products"."id" ASC LIMIT 1 | |
Spree::ProductProperty Load (0.4ms) S |
NewerOlder