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
#!/usr/bin/ruby | |
File.foreach(ARGV[0], sep="\n") do |input| | |
puts input.chomp.chars.permutation.map(&:join).sort.uniq.join(',') | |
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
{ | |
init: function(elevators, floors) { | |
elevators.dispatchElevator = function(floorNum, direction) { | |
if (elevator = elevators.already_going_to(floorNum, direction)) { | |
if (elevator.destinationQueue.indexOf(floorNum) < 2) { | |
return true; | |
} | |
} | |
var queues = elevators.map(function(elevator) { return elevator.destinationQueue.length }); | |
var min = queues.slice().sort()[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
module ActionView | |
module Template::Handlers | |
class Nokogiri | |
# Default format used by Builder. | |
class_attribute :default_format | |
self.default_format = Mime::XML | |
def call template | |
require 'nokogiri' |
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
product_rule: | |
match_none: none |
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 CreateActivators < ActiveRecord::Migration | |
def self.up | |
rename_table 'promotions', 'activators' | |
rename_column 'activators', 'code', 'to_migrate_code' | |
rename_column 'activators', 'usage_limit', 'to_migrate_usage_limit' | |
rename_column 'activators', 'combine', 'to_migrate_combine' | |
rename_column 'activators', 'match_policy', 'to_migrate_match_policy' | |
add_column 'activators', 'type', :string |