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 UserAddressBook | |
attr_accessor :user_id, :address_book_entry | |
def initialize(user_id, address_book_entry) | |
@user_id = user_id | |
@address_book_entry = address_book_entry | |
end | |
end | |
address_book1 = UserAddressBook.new(42, 'test') |
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 'dry-matcher' | |
success_case = Dry::Matcher::Case.new( | |
match: -> value { value.first == :ok }, | |
resolve: -> value { value.last } | |
) | |
failure_case = Dry::Matcher::Case.new( | |
match: -> value, *pattern { | |
value[0] == :err && (pattern.any? ? pattern.include?(value[1]) : true) |
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 'dry-monads' | |
class Address | |
attr_reader :street | |
def initialize(street = nil) | |
@street = street | |
end | |
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
class Success | |
def self.===(item) | |
item.status >= 200 && item.status < 300 | |
end | |
end | |
class Empty | |
def self.===(item) | |
item.response_size == 0 | |
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
require 'observer' | |
class Source | |
include Observable | |
def ping(int) | |
changed | |
notify_observers(int) | |
end | |
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
<Border Grid.Row="1" Style="{DynamicResource ListScreenContainerStyle}" | |
BorderThickness="{DynamicResource ListBorderThickness}"> | |
<ListView SelectionMode="Single" | |
ItemsSource="{Binding Path=Devices, Mode=OneWay}" | |
Style="{StaticResource VirtualisedMetroListView}" | |
BorderThickness="0"> | |
<ListView.ItemTemplate> | |
<DataTemplate> | |
<ContentControl cal:View.Model="{Binding}" /> | |
</DataTemplate> |
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
<Grid HorizontalAlignment="Left" Style="{DynamicResource MasterListContainerStyle}"> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="todo" /> | |
<RowDefinition Height="todo" /> | |
</Grid.RowDefinitions> | |
</Grid> |
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
<Button> | |
<Button.Template> | |
<ControlTemplate> | |
<Control Style="{DynamicResource SideUserImageStyle}" Tag="{Binding Path=User.Image}" /> | |
</ControlTemplate> | |
</Button.Template> | |
</Button> |
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
This took me longer that I will like to find out | |
curl "http://localhost:3000/v1/collections/42/items?fields[]=synopsis" -v -H "Content-Type: application/json" -H "X-Session-Token: xxx" --globoff |
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
Laptop laptop = Laptop.new | |
laptop.listener = KeyBoardListener.new | |
class KeyBoardListener | |
def key_press(key_code) | |
... | |
end | |
end |