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
// Requires official Node.js MongoDB Driver 3.0.0+ | |
var mongodb = require("mongodb"); | |
var client = mongodb.MongoClient; | |
var url = "mongodb://host:port/"; | |
client.connect(url, function (err, client) { | |
var db = client.db("test"); | |
var collection = db.collection("mains"); |
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
query{ | |
products{ | |
id | |
images{ | |
attachment { | |
url | |
} | |
} | |
optionTypes { | |
edges { |
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 Mergesort{ | |
constructor(numbers){ | |
this.numbers=numbers; | |
} | |
merge(left, right){ | |
var result=[]; | |
console.log("Left:"+left); | |
console.log("Right"+right); |
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 Inversioncount{ | |
constructor(numbers){ | |
this.numbers=numbers; | |
this.count=0; | |
} | |
merge(left, right){ | |
var result=[]; |
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
function getInversionCount(arr){ | |
var inv_count = 0; | |
var n=arr.length | |
for (var i = 0; i < n - 1; i++) | |
for (var j = i+1; j < n; j++) | |
if (arr[i] > arr[j]) | |
inv_count++; | |
return inv_count; | |
} |
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
prefix= fn doputs -> fn(s) -> IO.puts "#{s}" end 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
cap aborted! | |
SSHKit::Runner::ExecuteError: Exception while executing on host 52.88.81.221: scp: /tmp/cardfool/git-ssh.sh: Permission denied | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-scp-1.2.1/lib/net/scp.rb:398:in `await_response_state' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `call' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `process' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `block in preprocess' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `each' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `preprocess' | |
/Users/Daniel/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process' |
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
Rails.application.routes.draw do | |
# This line mounts Spree's routes at the root of your application. | |
# This means, any requests to URLs such as /products, will go to Spree::ProductsController. | |
# If you would like to change where this engine is mounted, simply change the :at option to something different. | |
# | |
# We ask that you don't use the :as option here, as Spree relies on it being the default of "spree" | |
mount Spree::Core::Engine, :at => '/' | |
Spree::Core::Engine.add_routes do | |
namespace :api do |
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
Rails.application.routes.draw do | |
# This line mounts Spree's routes at the root of your application. | |
# This means, any requests to URLs such as /products, will go to Spree::ProductsController. | |
# If you would like to change where this engine is mounted, simply change the :at option to something different. | |
# | |
# We ask that you don't use the :as option here, as Spree relies on it being the default of "spree" | |
mount Spree::Core::Engine, :at => '/' | |
Spree::Core::Engine.add_routes do | |
namespace :api do |
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::Shipment.class_eval do | |
audited associated_with: :order | |
has_associated_audits | |
def transfer_to_shipment(variant, quantity, shipment_to_transfer_to) | |
quantity_already_shipment_to_transfer_to = shipment_to_transfer_to.manifest.find{|mi| mi.line_item.variant == variant}.try(:quantity) || 0 | |
if (quantity <= 0 || self == shipment_to_transfer_to) |
NewerOlder