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
# 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 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 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 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 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, |
OlderNewer