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
var dic = [String: Int]() | |
dic["hello", default: 0] += 1 | |
dic // ["hello": 1] | |
func parse(_ string: String) -> String { | |
switch Int(string) { | |
case .some(7): return "SEVEN" | |
case 5?: return "FIVE" | |
case let x? where x < 10: return "1-9" | |
default: return "Not valid INT" |
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
extension Decimal { | |
var intValue: Int { | |
return NSDecimalNumber(decimal: self).intValue | |
} | |
} | |
extension Int { | |
func digitAt(i: Int) -> Int { | |
let div = pow(10, i).intValue | |
let x = self / div |
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
extension String { | |
var ascii: Int { | |
guard let u = UnicodeScalar(self) else { return -1 } | |
return Int(u.value) | |
} | |
} | |
"a".ascii // 97 | |
"A".ascii // 65 |
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
Converting your screencast/screen recording to Gif is not a big deal. All you need: | |
1. QuickTime Player to record your screen OR video file if you already have the video that you wanna convert | |
2. ffmpeg installed in mac | |
First of all, install HomeBrew using the following command | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
Then install ffmpeg using the following commmand: |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
//.. do other setup | |
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; | |
// Transition neatly from splash screen | |
// Very odd, on iPhone 5 you need to position the splash screen differently.. |
NewerOlder