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
| private let lock = NSRecursiveLock() | |
| func synchronize(closure: ()->()){ | |
| lock.lock() | |
| defer { | |
| closure() | |
| lock.unlock() | |
| } | |
| } |
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
| pbcopy < ~/.ssh/id_rsa.pub |
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
| // Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this. | |
| // The goal is basically to try to guarantee that every throwing function in the app throws an | |
| // ApplicationError instead of some unknown error type. We can't actually enforce this statically | |
| // But by following this convention we can simplify error handling | |
| enum ApplicationError: Error, CustomStringConvertible { | |
| // These are application-specific errors that may need special treatment | |
| case specificError1 | |
| case specificError2(SomeType) |
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
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| protocol Profilable: CustomStringConvertible { | |
| mutating func appendTime() -> Double | |
| } | |
| struct ProfilableArray: Profilable { | |
| private var expected: 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
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| class Solution | |
| { | |
| struct BigNumber | |
| { | |
| LinkedDigit data; |
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
| // Our server is calling the external API using call_api that is doing the HTTP | |
| // call. The API provider charges us if we make more than 10 calls per second. | |
| // | |
| // How would you implement something that keeps us below the limit? | |
| //: [Previous](@previous) | |
| import Foundation | |
| import PlaygroundSupport |
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
| using System; | |
| using Android.Widget; | |
| using Android.Graphics; | |
| using Android.Util; | |
| using Android.Text; | |
| using Android.Content; | |
| using Android.Runtime; | |
| using Java.Lang; | |
| using Android.Content.Res; |
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
| using Cirrious.MvvmCross.ViewModels; | |
| using System.Collections.ObjectModel; | |
| using System.Windows.Input; | |
| using System; | |
| using Cirrious.MvvmCross.Plugins.Messenger; | |
| namespace MvvmcrossTest.Core.ViewModels | |
| { | |
| public class FirstViewModel | |
| : MvxViewModel |
NewerOlder