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
| { | |
| "products":[ | |
| { | |
| "id":"eea560e7-86f3-4a9c-86ce-b57b8fdbc11a", | |
| "name":"Mid-Century Modern Accent Chair", | |
| "description":"This mid-century modern accent chair is a timeless piece that will add a touch of elegance to any room. It features a sleek, walnut frame and a comfortable, mustard yellow cushion. The chair is in excellent condition and has been well-maintained.", | |
| "picture":"https://storage.googleapis.com/online-boutique-product-data/Mid-Century%20Modern%20Accent%20Chair165", | |
| "priceUsd":{ | |
| "currencyCode":"USD", | |
| "units":3884, |
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
| colorTable: | |
| colorWhite: &colorWhite | |
| rgb: [255, 255, 255] | |
| hex: "FFFFFF" | |
| colorRed100: &colorRed100 | |
| rgb: [255, 255, 255] | |
| hex: "FFFFFF" | |
| colorRed300: &colorRed300 | |
| rgb: [255, 255, 255] | |
| hex: "FFFFFF" |
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
| require 'graph' | |
| require 'psych' | |
| steps = Psych.load(File.read(ARGV[0]))["steps"] | |
| previous_steps = [] | |
| digraph do | |
| steps.each do |step| | |
| id = step["id"] || step["name"] |
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
| data = File.read(ARGV[0]).split("\n").map { |l| l.split(": ").map(&:to_i) } | |
| layers = {} | |
| data.each do |a, b| | |
| layers[a] = b | |
| end | |
| max = ARGV[1].to_i |
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
| # A greedy algorithm for bin packing | |
| class Array | |
| def rest | |
| self[1..-1] | |
| end | |
| end | |
| def optimize_pack inventory, order | |
| loop do |
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
| require "google/cloud/monitoring/v3/metric_service_client" | |
| client = Google::Cloud::Monitoring::V3::MetricServiceClient.new | |
| project = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(PROJECT_ID) |
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
| interval = Google::Monitoring::V3::TimeInterval.new | |
| interval.start_time = Google::Protobuf::Timestamp.new(seconds: start_time) | |
| interval.end_time = Google::Protobuf::Timestamp.new(seconds: end_time) |
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
| require "google/cloud/monitoring/v3/metric_service_client" | |
| client = Google::Cloud::Monitoring::V3::MetricServiceClient.new | |
| project = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(PROJECT_ID) | |
| metric = "appengine.googleapis.com/system/memory/usage" | |
| end_time = Time.now.to_i | |
| start_time = end_time - (60 * 10) # 10 minutes |
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
| Apache License | |
| Version 2.0, January 2004 | |
| http://www.apache.org/licenses/ | |
| TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
| 1. Definitions. | |
| "License" shall mean the terms and conditions for use, reproduction, |
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
| require "google/cloud/storage" | |
| gcloud = Google::Cloud.new "Your Project", "Path To Your Key" | |
| storage = gcloud.storage | |
| bucket = storage.create_bucket "my_goat_pictures" | |
| bucket.create_file "goat.jpg", "uploaded_goat.jpg" |
NewerOlder