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:
| using System; | |
| using System.Windows.Input; | |
| /// <summary> | |
| /// A command whose sole purpose is to relay its functionality to | |
| /// other objects by invoking delegates. | |
| /// The default return value for the CanExecute method is 'true'. | |
| /// </summary> | |
| public class RelayCommand : ICommand | |
| { |
| // Declare three optional variables | |
| var firstName: String? | |
| var lastName: String? | |
| var age: Int? | |
| // EXAMPLE: if-Statement | |
| if let firstName = firstName { | |
| if let lastName = lastName { | |
| if let age = age, age >= 18 { | |
| doSomething(firstName, lastName, age) |
| // Declare an optional value | |
| var name: String? = "Roman" | |
| // Optional chaining | |
| name?.characters.count | |
| if name != nil { | |
| // Force unwrap | |
| name!.characters.count | |
| } |
| // Declare two optional values | |
| var firstName: String? = "Roman" | |
| var lastName: String? = "Blum" | |
| // Option 1: Nested | |
| if let firstName = firstName { | |
| if let lastName = lastName { | |
| // Use firstName and lastName | |
| } | |
| } |
| /* Example JSON Object | |
| { | |
| "key": { | |
| "nestedKey": { | |
| "nestedKey": { | |
| "nestedKey": 42.0 | |
| } | |
| } | |
| } |
| // Declare an optional variable | |
| var name: String? = "Roman" | |
| guard let name = name else { | |
| print("name is nil") | |
| return | |
| } | |
| print(name) | |
| // Output: Roman |
| var text: String? | |
| print(text) | |
| // Output: nil | |
| print(text ?? "B") | |
| // Output: B | |
| text = "A" | |
| print(text ?? "B") | |
| // Output: A | |
| print(text) | |
| // Output: Optional("A") |
| // int num = null; -> Error | |
| int? num = null; | |
| if (num.HasValue) | |
| { | |
| System.Console.WriteLine("num = " + num.Value); | |
| } | |
| else | |
| { | |
| System.Console.WriteLine("num = Null"); |
| (function () { | |
| l1 = 'STEP 1'; | |
| console.log(l1); // Output: STEP 1 | |
| if (true) { | |
| console.log(l1); // Output: STEP 1 | |
| var l1 = 'STEP 2'; // var isn't block-scoped, gets hoisted | |
| console.log(l1); // Output: STEP 2 | |
| } |