I hereby claim:
- I am smileyborg on github.
- I am smileyborg (https://keybase.io/smileyborg) on keybase.
- I have a public key whose fingerprint is C460 F9E5 7D47 4E26 E24A 0F4A 7FCD A6ED 6139 A71A
To claim this, I am signing this object:
// UICollectionView Objective-C example | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
if (selectedIndexPath != nil) { | |
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
if (coordinator != nil) { | |
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
import UIKit | |
import MobileCoreServices | |
let image = UIImage() // your actual image | |
let itemProvider = NSItemProvider() | |
itemProvider.registerDataRepresentation(forTypeIdentifier: kUTTypeJPEG as String, visibility: .all) { (completionBlock) -> Progress? in | |
let unitsOfWork = 10 + Int64(arc4random_uniform(UInt32(10))) // 10 - 19 units | |
let progress = Progress.discreteProgress(totalUnitCount: unitsOfWork) |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
require 'set' | |
UMBRELLA_HEADER_PATH = ARGV[0] # The path to the umbrella header containing all the headers | |
SOURCE_ROOT_PATH = ARGV[1] # The path containing the source files to convert (will be recursively searched) | |
FRAMEWORK_NAME = File.basename(UMBRELLA_HEADER_PATH, ".*") # Assumes that the framework name is the same as the umbrella header filename (e.g. "MyFramework" for "MyFramework.h") | |
UMBRELLA_IMPORT_REGEX = /#import\s+<#{FRAMEWORK_NAME}\/.+\.h>/ # Matches "#import <FrameworkName/Header.h>" | |
FRAMEWORK_HEADER_REGEX = /(?<=<#{FRAMEWORK_NAME}\/).+\.h(?=>)/ # Matches "Header.h" in "<FrameworkName/Header.h>" |
/** | |
* The following preprocessor macros can be used to adopt the new nullability annotations and generics | |
* features available in Xcode 7, while maintaining backwards compatibility with earlier versions of | |
* Xcode that do not support these features. | |
*/ | |
#if __has_feature(nullability) | |
# define __ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN | |
# define __ASSUME_NONNULL_END NS_ASSUME_NONNULL_END | |
# define __NULLABLE nullable |
// | |
// UIView+Orientation.h | |
// | |
#import <UIKit/UIKit.h> | |
// These macros should only be used if you MUST know the interface orientation for the device itself, for example when displaying a new UIWindow. | |
// This should be very rare; generally you should only look at the immediate parent view's size (or "view orientation" using the category below). | |
#define StatusBarOrientationIsPortrait UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) | |
#define StatusBarOrientationIsLandscape UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) |
#!/bin/bash | |
# A shell script to provide a meaningful diff output for a merge commit that can be used to determine whether the merge was evil. | |
# The script should be run from outside the git repository, with two arguments: | |
# 1 - the directory of the git repository | |
# 2 - the SHA for the merge commit to inspect | |
# The script will output one file: | |
# - the merge redone fresh without any conflicts resolved, diff'ed to the actual merge | |
output_file="diff.txt" |
/* Note that I have uncommented Line 9 to prevent constraint exceptions before the cells actually layout at their correct size. */ | |
- (void)updateConstraints | |
{ | |
if (!self.didSetupConstraints) { | |
// Note: if the constraints you add below require a larger cell size than the current size (which is likely to be the default size {320, 44}), you'll get an exception. | |
// As a fix, you can temporarily increase the size of the cell's contentView so that this does not occur using code similar to the line below. | |
// See here for further discussion: https://github.com/Alex311/TableCellWithAutoLayout/commit/bde387b27e33605eeac3465475d2f2ff9775f163#commitcomment-4633188 | |
self.contentView.bounds = CGRectMake(0.0f, 0.0f, 99999.0f, 99999.0f); |
func setupConstraints() | |
{ | |
let views: NSArray = [view1, view2, view3] | |
views.autoDistributeViewsAlongAxis(.Horizontal, withFixedSpacing: 10.0, insetSpacing: true, matchedSizes: false, alignment: .AlignAllTop) | |
// if you don't like creating an intermediate constant, the following works using Xcode 6.1 GM: | |
[view1, view2, view3].autoDistributeViewsAlongAxis(.Horizontal, withFixedSpacing: 10.0, insetSpacing: true, matchedSizes: false, alignment: .AlignAllTop) | |
} |