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
func getJSONData() -> NSData? { | |
guard let path = NSBundle.mainBundle().pathForResource("staticText", ofType: "json") else { | |
print("error finding file") | |
return nil | |
} | |
return NSData(contentsOfFile: path) | |
} | |
func dataToJSON(data:NSData) -> [String: AnyObject]? { |
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
git config --global init.templatedir '~/.git-templates' | |
mkdir -p ~/.git-templates/hooks | |
# Create ~/.git-templates/hooks/prepare-commit-msg with the above content | |
chmod +x ~/.git-templates/hooks/prepare-commit-msg | |
# In any existing git repos you want to have this hook | |
git init # this will copy the hooks into the git repo, but will not overwrite any existing hooks |
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
let delay = 0.25 * Double(NSEC_PER_SEC) | |
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay)) | |
dispatch_after(time, dispatch_get_main_queue()) { | |
/// do stuff | |
} |
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
Donny Wals [8:46 AM] | |
Imagine this, we’re going to build a house together. You are really good at the designing and overall building but plumbing isn’t your thing. So you want me to do the plumbing for you. You define a set of skills I need to have such as this list: | |
protocol NinjaPlumber { | |
func fixSink() | |
func layDownPipes() | |
func makeSureNothingIsClogged() -> Bool | |
func dance() // because we all need a dancing plumber | |
} | |
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
#define __SXMWebAction__UnavailableConstructor__(x) __attribute__((unavailable("This class must be instantiated using '"x"WithJSON:' or '"x"WithHTMLJSON:'"))) | |
#pragma mark - Unavailable Super Methods | |
- (id)init __SXMWebAction__UnavailableConstructor__("init"); | |
+ (id)new __SXMWebAction__UnavailableConstructor__("webAction"); |
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
alias unfuckxcode='rm -rf ~/Library/Developer/Xcode/DerivedData; rm -rf ~/Library/Caches/com.apple.dt.Xcode; rm -rf $(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache; rm -rf /var/folders/**/com.apple.DeveloperTools*; rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache; echo -e "\xF0\x9F\x94\xA5 BURN IT ALL\xF0\x9F\x94\xA5"' |
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
// configure labels: | |
- (void)configureView | |
{ | |
self.textSizeLabel.text = [[UIApplication sharedApplication] preferredContentSizeCategory]; | |
self.headlineLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; | |
self.subheadLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]; | |
self.bodyLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; | |
self.caption1Label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; | |
self.caption2Label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2]; |
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
let footer = TaxEstimatorFooterView.newViewWithNib() as? TaxEstimatorFooterView |
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
Objective-C: | |
for (NSString* family in [UIFont familyNames]) | |
{ | |
NSLog(@"%@", family); | |
for (NSString* name in [UIFont fontNamesForFamilyName: family]) | |
{ | |
NSLog(@" %@", name); | |
} |
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
protocol SectionSelected { | |
func sectionSelected(section: SectionType) | |
} | |
class TestClass { | |
weak var tabBarDelegate: SectionSelected? | |
var sectionType: SectionType? { | |
didSet { | |
sectionSelected() |