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
orders(first: 5, filter: { customer: "stayhome@example.com" }, status: FULFILLED) { | |
# edges { | |
# node { | |
# id | |
# number | |
# created | |
# userEmail | |
# } | |
# } | |
# } |
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
{"loggedIn":true,"data":[{"circuitId":"albert_park","url":"http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit","circuitName":"Albert Park Grand Prix Circuit","Location":{"lat":"-37.8497","long":"144.968","locality":"Melbourne","country":"Australia"}},{"circuitId":"americas","url":"http://en.wikipedia.org/wiki/Circuit_of_the_Americas","circuitName":"Circuit of the Americas","Location":{"lat":"30.1328","long":"-97.6411","locality":"Austin","country":"USA"}},{"circuitId":"bahrain","url":"http://en.wikipedia.org/wiki/Bahrain_International_Circuit","circuitName":"Bahrain International Circuit","Location":{"lat":"26.0325","long":"50.5106","locality":"Sakhir","country":"Bahrain"}},{"circuitId":"BAK","url":"http://en.wikipedia.org/wiki/Baku_City_Circuit","circuitName":"Baku City Circuit","Location":{"lat":"40.3725","long":"49.8533","locality":"Baku","country":"Azerbaijan"}},{"circuitId":"catalunya","url":"http://en.wikipedia.org/wiki/Circuit_de_Barcelona-Catalunya","circuitName":"Circuit de Barcelona-Cataluny |
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
$('#profile-subscriptions-form').on('submit', () => { | |
var $form = $(this); | |
var $validationFields = $form.find("[data-validate]"); | |
$validationFields = $validationFields.map(function() { | |
var $this = $(this); | |
if(typeof $this.attr("data-validate-required") !== "undefined" || $this.val() !== "") { | |
return $this; | |
} |
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
1.2.0 | |
* Implemented ResourceArray::getItems to allow access to the values of a ResourceArray as an actual PHP array. | |
2.0.0 | |
* Moved file classes to a sub-namespace Contentful\File [BREAKING]. | |
* Contentful\File to Contentful\File\File | |
* Contentful\ImageFile to Contentful\File\ImageFile | |
* Contentful\ImageOptions to Contentful\File\ImageOptions | |
2.1.0 |
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
def apply_coupons(cart:[], coupons:[]) | |
coupons.each do |e| | |
e.each do |key, value| | |
if cart[value] | |
if cart[value][:count] - e[:num] >= 0 | |
cart[value][:count] -= e[:num] | |
if cart["#{value} W/COUPON"].nil? | |
cart["#{value} W/COUPON"] = cart[value] | |
cart["#{value} W/COUPON"] = {:price => e[:cost], clearance: cart[value][:clearance]} | |
cart["#{value} W/COUPON"][:count] = 1 |
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
def sort_by_nth_letter(array, num) | |
array.sort {|a, b| a[num] <=> b[num] } | |
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
sentence = <<-something | |
Steven likes the movies. Blake likes to ride his bike but hates movies. | |
Blake is taller than steven. Steven is a great teacher. | |
something | |
counter = Hash.new(0) | |
sentence.gsub('.', '').split(' ').each do |i| counter[i] += 1 end | |
counter.each do |k, v| puts "'#{k}' appears #{v} times" if v >= 3 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
sentence = <<-something | |
Steven likes the movies. Blake likes to ride his bike but hates movies. | |
Blake is taller than steven. Steven is a great teacher. | |
something | |
sentence2 = sentence.gsub('.', '').split(' ') | |
sentence2 = sentence2.collect { |i| i = i.upcase } | |
num = 1 | |
word = nil | |
count = 0 | |
counter = 0 |
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
flatiron_school = {:teachers=>[{:name=>"steph"}, {:name=>"uzo"}, {:name=>"blake"}], :students => [{:name => "giancarlo", :grade => 100, :address => "bronx"},{:name => "jamie", :grade => 200, :address => "NJ"}]} | |
flatiron_school.each_pair do |k, v| | |
v.each do |e| | |
e.each_pair do |key, value| | |
puts value if key == :name | |
end | |
end | |
end | |
def print_specific_elements(hash, element) |