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
#!/bin/sh | |
RUBY=`which ruby` | |
if [[ $RUBY = '/usr/bin/ruby' ]] ; then | |
echo "error: You must run the following command from the command-line." | |
echo "sudu gem pod install" | |
else | |
if [[ -e 'Podfile' ]]; then | |
gem pod install |
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
#!/bin/sh | |
// What The Archive! | |
// The argument passed in should be the Xcode project name so it can find and run lipo on each archive to | |
// look for each of the supported architectures to help the developer see what is there and what is missing. | |
// It looks in the DerivedData folder for the most recent matching folder using the given project name. | |
PROJECT_NAME=$1 | |
BASE_DIR=~/Library/Developer/Xcode/DerivedData/ |
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
- (NSIndexPath *)indexPathForView:(UIView *)view inTableView:(UITableView *)tableView { | |
UIView *superview = view; | |
while (superview && ![superview isKindOfClass:[UITableViewCell class]]) { | |
superview = superview.superview; | |
} | |
if ([superview isKindOfClass:[UITableViewCell class]]) { | |
NSIndexPath *indexPath = [tableView indexPathForCell:(UITableViewCell *)superview]; | |
return indexPath; | |
} |
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
$(function() { | |
var gistPrefix = 'https://gist.github.com/'; | |
var embedGists = function() { | |
$('a[href^="' + gistPrefix + '"]').each(function(index, anchor) { | |
var href = $(anchor).attr('href'); | |
var gistId = href.substring(gistPrefix.length); | |
var url = gistPrefix + gistId + '.json?callback=?'; | |
$.getJSON(url, function(gistData) { | |
var cssUrl = gistPrefix + gistData.stylesheet; |
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
BOOL hasBlur = blurRadius > __FLT_EPSILON__; | |
BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > __FLT_EPSILON__; |
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
XCTAssertEqualWithAccuracy(image.size.width, 1, FLT_EPSILON, @"Invalid image width"); | |
XCTAssertEqualWithAccuracy(image.size.height, 1, FLT_EPSILON, @"Invalid image height"); |
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
- (UIImage *)screenshotOfView:(UIView *)view excludingViews:(NSArray *)excludedViews { | |
if (!floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { | |
NSCAssert(FALSE, @"iOS 7 or later is required."); | |
} | |
// hide all excluded views before capturing screen and keep initial value | |
NSMutableArray *hiddenValues = [@[] mutableCopy]; | |
for (NSUInteger index=0;index<excludedViews.count;index++) { | |
[hiddenValues addObject:[NSNumber numberWithBool:((UIView *)excludedViews[index]).hidden]]; | |
((UIView *)excludedViews[index]).hidden = TRUE; |
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
+ (CGFloat)widthForAttributedString:(NSAttributedString *)text maxHeight:(CGFloat)maxHeight { | |
CGSize size = [self sizeForAttributedString:text maxSize:CGSizeMake(CGFLOAT_MAX, maxHeight)]; | |
return size.width; | |
} | |
+ (CGFloat)widthForString:(NSString *)text font:(UIFont *)font maxHeight:(CGFloat)maxHeight { | |
CGSize size = [self sizeForString:text font:font maxSize:CGSizeMake(CGFLOAT_MAX, maxHeight)]; | |
return size.width; | |
} |
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 table for check ins (adjust to use real tables) | |
-- Table: check_ins | |
-- DROP TABLE check_ins; | |
CREATE TABLE check_ins | |
( | |
check_in_id serial NOT NULL, | |
check_in_key character varying(20) NOT NULL, | |
note text NULL, |
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)openLyft { | |
NSURL *lyftURL =[NSURL URLWithString:@"fb275560259205767://"]; | |
if ([[UIApplication sharedApplication] canOpenURL:lyftURL]) { | |
[[UIApplication sharedApplication] openURL:lyftURL]; | |
} | |
else { | |
NSString *appStoreLink = @"itms-apps://itunes.apple.com/us/app/lyft/id529379082?mt=8"; | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreLink]]; | |
} | |
} |