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 Photos | |
import AVFoundation | |
func ALAssetToPHAsset(asset:ALAsset) -> PHAsset { | |
var fetchOptions: PHFetchOptions = PHFetchOptions() | |
var url:NSURL = asset.valueForProperty(ALAssetPropertyAssetURL) as! NSURL | |
let fetchResult:PHFetchResult = PHAsset.fetchAssetsWithALAssetURLs([url], options: fetchOptions) | |
return fetchResult.firstObject as! PHAsset | |
} |
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
# Close Xcode & the iOS Simulator | |
# http://stackoverflow.com/a/30940055 | |
# Remove any old runtimes from this directory. | |
cd /Library/Developer/CoreSimulator/Profiles/Runtimes | |
# e.g. | |
sudo rm -rf iOS\ 8.1.simruntime | |
# http://stackoverflow.com/a/11790983 | |
# Remove the download receipts for simulators you don't need anymore. |
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
# Upgrading Xcode can wreak havok on your custom Alcatraz setup. | |
# Each plugin must list the UUIDs of Xcode that it supports. Thus | |
# with each new release we must update the list of UUIDs for each | |
# plugin we want to continue using. | |
# | |
# You can discover the UUID of an Xcode app bundle by running this command | |
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID | |
# > 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 |
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
void logFonts(UIView* view); | |
void logColors(UIView* view); |
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
// Example — say you had some content for a scrollView. | |
// Create a contentView and add each row as a subview. | |
// Then simply call the category method on the subviews array to layout | |
// the subviews as rows. | |
// | |
// This requires that the contentView be setup via autolayout to | |
// properly pin to the scrollView. | |
[contentView addSubviews:@[ | |
viewA, |
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
// https://github.com/smileyborg/TableViewCellWithAutoLayout/blob/master/TableViewCellWithAutoLayout/TableViewController/RJTableViewController.m | |
// http://stackoverflow.com/a/18746930/123781 | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
// This project has only one cell identifier, but if you are have more than one, this is the time | |
// to figure out which reuse identifier should be used for the cell at this index path. | |
NSString *reuseIdentifier = CellIdentifier; | |
// Use the dictionary of offscreen cells to get a cell for the reuse identifier, creating a cell and storing |
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 <UIKit/UIKit.h> | |
typedef BOOL (^TestViewCallback)(UIView*); | |
@interface UIView (FindSubview) | |
- (UIView*) findSubviewWithTest:(TestViewCallback)callback; | |
- (BOOL) hitByGesture:(UIGestureRecognizer*)recognizer; | |
@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
// Retina-ready version of this StackOverflow answer | |
// http://stackoverflow.com/a/6672628/123781 | |
#import <UIKit/UIKit.h> | |
@interface UIImage (NegativeImage) | |
- (UIImage *)negativeImage; | |
@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
// ---- | |
// Sass (v3.3.14) | |
// Compass (v1.0.0.rc.1) | |
// ---- | |
// | |
// Code from http://thesassway.com/intermediate/a-standard-module-definition-for-sass | |
// | |
// # Thoughts | |
// |
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
// ---- | |
// Sass (v3.3.14) | |
// Compass (v1.0.0.rc.1) | |
// ---- | |
$text-base: ( | |
font-size: 1.0rem, | |
line-height: 1.8rem, | |
font-weight: normal, | |
text-color: #333 |