I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | |
// Override point for customization after application launch. | |
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
var nav1 = UINavigationController() | |
var first = FirstViewController(nibName: nil, bundle: nil) | |
nav1.viewControllers = [first] | |
var second = SecondViewController(nibName: nil, bundle: nil) | |
var nav2 = UINavigationController() |
import Foundation | |
/// An abstract class that makes building simple asynchronous operations easy. | |
/// Subclasses must implement `execute()` to perform any work and call | |
/// `finish()` when they are done. All `NSOperation` work will be handled | |
/// automatically. | |
open class AsynchronousOperation: Operation { | |
// MARK: - Properties |
class TableViewContorllerThatWorks: UITableViewController { | |
override init(style: UITableViewStyle) { | |
super.init(style: style) | |
} | |
required init(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
enum JSONResult<V> { | |
case value(V) | |
case none | |
func get(_ key: String) -> JSONResult<[String: Any]> { | |
if let v = self.get(key, as: [String: Any].self) { | |
return .value(v) | |
} | |
return .none |
I recently happened upon a very interesting implementation of popen()
(different API, same idea) called popen-noshell using clone(2)
, and so I opened an issue requesting use of vfork(2)
or posix_spawn()
for portability. It turns out that on Linux there's an important advantage to using clone(2)
. I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.
This is not a paper. I assume reader familiarity with
fork()
in particular and Unix in general, though, of course, I link to relevant wiki pages, so if the unfamiliar reader is willing to go down the rabbit hole, they should be able to come ou
final class CacheLRU<Key: Hashable, Value> { | |
private struct CachePayload { | |
let key: Key | |
let value: Value | |
} | |
private let capacity: Int | |
private let list = DoublyLinkedList<CachePayload>() | |
private var nodesDict = [Key: DoublyLinkedListNode<CachePayload>]() |
The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the
⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,