🏋️♂️
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
class CreateTask | |
include Wisper::Publisher | |
def call(attributes) | |
task = Task.create(attributes) | |
if task.valid? | |
publish :success, task | |
else | |
publish :error, task |
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 'digest/md5' | |
module GravatarHelper | |
def gravatar_for_email(email) | |
"#{gravatar_endpoint}#{hash_for_email(email)}" | |
end | |
def hash_for_email(email) | |
Digest::MD5.hexdigest(email) | |
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
require 'digest/md5' | |
module GravatarHelper | |
# previous implementation | |
# ... | |
def gravatar_for_email(email) | |
self.class.gravatar_for_email(email) | |
end | |
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
require 'digest/md5' | |
module GravatarHelper | |
module_function | |
def gravatar_for_email(email) | |
"#{gravatar_endpoint}#{hash_for_email(email)}" | |
end | |
def hash_for_email(email) | |
Digest::MD5.hexdigest(email) |
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 Storage | |
module Models | |
class Brand < ActiveRecord::Base; end | |
end | |
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
class BrandInMemoryAdapter | |
attr_accessor :db | |
def initialize | |
@db = [] | |
end | |
def all | |
db | |
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
#!/usr/bin/env ruby | |
# WANT_JSON | |
require 'rubygems' | |
require 'json' | |
File.open(ARGV[0]) do |arguments_stream| | |
begin | |
data = JSON.parse(arguments_stream.read) | |
dir_path = data.fetch 'dir_path' |
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
class OrderForm | |
constructor: (type, frequencyNumber, frequencyPeriod, name, mail, company, cvr, phone, address, products, message) -> | |
@type = type | |
@frequencyNumber = frequencyNumber | |
@frequencyPeriod = frequencyPeriod | |
@name = name | |
@mail = mail | |
@company = company | |
@cvr = cvr | |
@phone = phone |
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
@OrderService.sendOrder new OrderForm( | |
@$scope.type | |
@$scope.frequencyNumber | |
@$scope.frequencyPeriod | |
@$scope.name | |
@$scope.mail | |
@$scope.company | |
@$scope.cvr | |
@$scope.phone | |
@$scope.address |
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
class Foo | |
def initialize(foo:, bar:) end | |
end | |
Foo.new(foo: 1, bar: false) | |
################################ | |
class Bar | |
def initialize(foo, bar) end |