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
struct Sugar: Eatable { | |
var taste: Taste = .sweet | |
} |
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
extension Eatable { | |
func isBitter() -> Bool { | |
return self.taste == .bitter | |
} | |
} |
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
enum Taste { | |
case sweet | |
case bitter | |
case sour | |
case spicy | |
case salty(Int) | |
} |
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
struct Dog { | |
var name: String | |
var weight: Int | |
} | |
var myDog = Dog(name: "Ranger", weight: 10) | |
var yourDog = myDog //Deep copy | |
yourDog.name = "Puncher" | |
print(myDog) // Dog(name: "Ranger", weight: 10) | |
print(yourDog) // Dog(name: "Puncher", weight: 10) |
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
protocol Eatable { | |
var taste: Taste | |
func isBitter() -> Bool // No arg function syntax: | |
} // func functionName() -> ReturnType |
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
func test_fetch_photo_fail() { | |
// Given a failed fetch with a certain failure | |
mockAPIService.error = APIError.permissionDenied | |
// When | |
sut.initFetch() | |
// Sut should display predefined error message | |
XCTAssertEqual( sut.alertMessage, error.rawValue ) |
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 MockAPIService: APIServiceProtocol { | |
var completeClosure: ((Bool, [Photo], APIError?) -> ())! | |
var photos: [Photo] = [] | |
var error: APIError? | |
func fetchPopularPhoto(complete: @escaping (Bool, [Photo], APIError?) -> ()) { | |
isFetchPopularPhotoCalled = true | |
complete(error == nil, photos, error) | |
} | |
} |
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
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# | |
# agnoster's Theme - https://gist.github.com/3712874 | |
# A Powerline-inspired theme for ZSH | |
# | |
# # README | |
# | |
# In order for this theme to render correctly, you will need a | |
# [Powerline-patched font](https://gist.github.com/1595572). | |
# |
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
[github] | |
user = dineshba | |
[user] | |
name = Dinesh Balasubramanian | |
email = [email protected] | |
[core] | |
pager = less -FRX | |
#editor = atom --wait | |
editor = vi | |
autocrlf = input |
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
" Use Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
set hlsearch | |
set incsearch | |
" ================ General Config ==================== | |
colorscheme default | |
set number "Line numbers are good | |
set backspace=indent,eol,start "Allow backspace in insert mode | |
set history=1000 "Store lots of :cmdline history |