This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
ffmpeg -i input.m4v -pix_fmt rgb24 -r 10 -y -s [width]x[height] output.gif |
When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.
So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.
Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?
I'm going to cover three things in this post:
import UIKit | |
struct Screen<A> { | |
let run: (A -> ()) -> UIViewController | |
} | |
struct Step<A> { | |
let build: (navigationController: UINavigationController, callback: A -> ()) -> UIViewController | |
} |
On why stateful code is bad | |
=========================== | |
STUDENT: Sir, can I ask a question? | |
TEACHER: Yes! | |
STUDENT: How do you put an elephant inside a fridge? | |
TEACHER: I don't know. | |
STUDENT: It's easy, you just open the fridge and put it in. I have another question! | |
TEACHER: Ok, ask. | |
STUDENT: How to put a donkey inside the fridge? |
import UIKit | |
import XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
func perform(initial: Int) { | |
var value: Int = initial | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1), dispatch_get_main_queue()) { [myConstant = value] in | |
print("constant in first block \(myConstant)") | |
print("captured \(value)") | |
value = initial * 2 |
#How to use Bundler with iOS projects
You probably stuck with situation when after finishing for example bundle install && bundle exec pod install
Bundler couldn't access gems which he just download. Some of you may think "RVM is the answer!" and yes it is, but what if it is not?
##Don't use macOS's gems. Just DON'T.
your_app_dir
Gemfile
if not create one