Skip to content

Instantly share code, notes, and snippets.

View zorn's full-sized avatar
💸
Elixir Contractor For Hire

Mike Zornek zorn

💸
Elixir Contractor For Hire
View GitHub Profile
@zorn
zorn / gist:46ceee6cc3624fac7d48
Created April 9, 2015 13:53
All of the properties you can use UIAppearance on...
Appearance Properties
Link:iPhoneOS.platform zorn$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
Link:Headers zorn$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'
./UIActivityIndicatorView.h:@property (readwrite, nonatomic, retain) UIColor *color NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
./UIAppearance.h:/* To participate in the appearance proxy API, tag your appearance property selectors in your header with UI_APPEARANCE_SELECTOR.
./UIAppearance.h:#define UI_APPEARANCE_SELECTOR __attribute__((annotate("ui_appearance_selector")))
./UIBarButtonItem.h:- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
// Playground - noun: a place where people can play
import UIKit
let action1 = {
println("action1")
}
let action2 = {
println(2)
@zorn
zorn / Code of Conduct.md
Last active August 29, 2015 14:15
Code of Conduct

Moving this to:

{
"people" : [
{
"first_name" : "Malcolm",
"last_name" : "Reynolds"
},
{
"first_name" : "Zoe",
"last_name" : "Washburne"
},
@zorn
zorn / gist:81597fc1552f113e262b
Last active August 29, 2015 14:09
Help me write a simple Swift function to load a string from a file
import Foundation
struct ShowdownDataLoader {
// So this is a simple function that should return a string from a file but it sucks.
// if feels way to verbose and I hate all the indentation. Please show me how I might
// be able to refactor it.
// Please be additive to the GIST with your suggestion so others can see the origianl.

Thanks for email.

The Mac app should be optional. If it's not there you skip behavior, if it is there, you run behavior.

You shouldn't even need any special behavior if the app is running in a Development configuration, only a Release. There are no dSYMs to upload during Development.

And just to share while I have your ear, another reason I choose not to use Crashlytics is -- I want to pay for my services. I don't like paying via letting you snoop on my data and reselling it.

Thanks for hearing my feedback.

@zorn
zorn / gist:7981551
Created December 16, 2013 02:31
Doesn't animate. Is there a known issue mixing `instantiateViewControllerWithIdentifier` with `presentViewController`? Seeing similar behavior in another app.
- (void)presentAccountChooser
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *navVC = [storyboard instantiateViewControllerWithIdentifier:@"AccountChooserViewControllerNavVC"];
AccountChooserViewController *accountChooserVC = (AccountChooserViewController *)[navVC topViewController];
accountChooserVC.accounts = [self.twitterStore systemTwitterAccounts];
accountChooserVC.delegate = self;
NSLog(@"modalTransitionStyle %d", self.modalTransitionStyle);
navVC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
navVC.modalPresentationStyle = UIModalPresentationFullScreen;
// Download all assets from https://developer.apple.com/wwdc/videos
// Warning: might take up a lot of disk space
NodeList.prototype.toArray = function () {
return Array.prototype.slice.call(this);
};
[].concat.apply([], document.querySelectorAll("li.session").toArray().map(function(session){
var sessionID = session.id.match(/^\d+/)[0];
var title = session.querySelector(".title").innerText;
// Download all assets from https://developer.apple.com/wwdc/videos
// Warning: might take up a lot of disk space
NodeList.prototype.toArray = function () {
return Array.prototype.slice.call(this);
};
[].concat.apply([], document.querySelectorAll("li.session").toArray().map(function(session){
var sessionID = session.id.match(/^\d+/)[0];
var title = session.querySelector(".title").innerText;
- (id)initWithBeer:(BHBeer *)beer
{
NSAssert(beer != nil, @"beer is required");
self = [super init];
if (self) {
self.beer = beer;
}
return self;
}