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
100.times do |i| | |
Thread.new { puts "Index: #{i}"} | |
end |
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
module DependencySupport | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
# Substitutes a give dependency with a provided value | |
# will raise an exception if a provided dependency is missing | |
# @param [Sumbol] dependency_name | |
# @param [*] value |
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
# @param [Integer] order_id order | |
# @return [Hash] | |
# @example | |
# | |
# teams: { | |
# members-with-goms: [45, 21, 41], | |
# members-with-orders: [21, 41], | |
# member-order-totals: { | |
# 45: 1400, | |
# 21: 1678 |
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
module Ordering | |
module Events | |
class CartCleared < ::Events::Event | |
values do | |
attribute :order_id, Integer | |
attribute :group_order_member_ids, Array[Integer] | |
attribute :order_item_ids, Array[Integer] | |
end |
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
module Orders | |
class CreateTeamsMeta < FoodeeService | |
dependency :order_dao, Order | |
attr_accessor :order | |
# @param [Integer] order_id order | |
# @return [Hash] | |
# @example |
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
hash_a = {foo: 'bar', baz: 'qux'} | |
hash_b = {foo: 'baz'} | |
hash_c = hash_a.merge(hash_b) do |key, old, new| | |
[old, new] | |
end | |
hash_c == { | |
foo: ['bar', 'baz'], | |
baz: 'qux' |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
queryParams: ['foo'], | |
foo: '', | |
actions: { |
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
def self.exercise_contact(s = new.login, contact_id: 108080) | |
puts "Fetching a contact by id #{contact_id}" | |
s.flipper[:use_salesforce_connect].disable | |
old_contact = s.contacts.get(contact_id) | |
s.flipper[:use_salesforce_connect].enable | |
new_contact = s.contacts.get(contact_id) | |
raise 'Contacts did not match' unless new_contact.to_h <= old_contact | |
end |
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
module Broadcasters | |
class OrderBroadcaster | |
include Wisper::Publisher | |
include DependencySupport::NullSubstitute | |
def changed(order) | |
// do some stuff | |
end | |
end | |
end |