This file contains 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
defaults write com.apple.finder QLEnableXRayFolders 1 |
This file contains 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
@interface NSNumber (Enumeration) | |
- (void)times:(void (^)(NSUInteger index, BOOL *stop))block; | |
@end |
This file contains 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
// 1. | |
// “Safe” but retain cycle. | |
[self setCompletionBlock:^{ | |
NSLog(@"1: %@", self->_foo); | |
}]; | |
// 2. | |
// Unsafe. Could dereference nil. | |
__weak BCThing *weakSelf = self; |
This file contains 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
// | |
// MOAnnotatedCalendarView.h | |
// MOKit | |
// | |
// Created by Ben Cochran on 9/4/13. | |
// Copyright (c) 2013 Ben Cochran. All rights reserved. | |
// | |
#import "MOCalendarView.h" |
This file contains 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
#!/usr/bin/env ruby | |
# | |
# This script can be used to check the in-store availability of the iPhone 5S. | |
# By default, it searches for all AT&T models. You can change this by editing | |
# the MY_DEVICES array below. While the Apple API supports searching for | |
# multiple devices at once, there is a limit. | |
# | |
# Once you have properly configured the MY_DEVICES array, you can run this script | |
# from the terminal. It takes a single parameter, which should be the zip code you | |
# wish to use for your search. |
This file contains 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
import Foundation | |
func doStuff(item: Any) { | |
println("Do stuff with this: \(item)") | |
} | |
class Foo { | |
func doStuff() { | |
doStuff(self) // <- Won’t compile. “Cannot convert 'Foo' to type '() -> ()'” | |
} |
This file contains 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
class MonolithViewController: UIViewController { | |
enum InnerSegueType: String { | |
case WebView | |
case Inspector | |
case Gadget = "SomeNameMismatch" | |
} | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
guard let identifier = segue.identifier, | |
let segueType = InnerSegueType(rawValue: identifier) else { |
This file contains 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
import Foundation | |
import ReactiveCocoa | |
//: # Backoff | |
//: ## Retry with backoff operator | |
extension SignalProducerType { | |
func retryWithBackoff<S: SequenceType where S.Generator.Element == NSTimeInterval>(strategy: S) -> SignalProducer<Value, Error> { | |
var generator = strategy.generate() |