Skip to content

Instantly share code, notes, and snippets.

View stevederico's full-sized avatar

Steve Derico stevederico

View GitHub Profile
@stevederico
stevederico / UImage resizeWithRatio
Created October 20, 2011 21:14
Great UIImage Resize Method
// Resizes the image according to the given content mode, taking into account the image's orientation
- (UIImage *)resizedImageWithContentMode:(UIViewContentMode)contentMode imageToScale:(UIImage*)imageToScale bounds:(CGSize)bounds interpolationQuality:(CGInterpolationQuality)quality {
//Get the size we want to scale it to
CGFloat horizontalRatio = bounds.width / imageToScale.size.width;
CGFloat verticalRatio = bounds.height / imageToScale.size.height;
CGFloat ratio;
switch (contentMode) {
case UIViewContentModeScaleAspectFill:
ratio = MAX(horizontalRatio, verticalRatio);
@stevederico
stevederico / gist:1592353
Created January 11, 2012 01:19
Rate in App Store Code
- (void)rateInAppStore {
NSString *idString = @"999999999";
NSString *countrtyString = @"us";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/%@/app/id%@?mt=8", countrtyString, idString]]];
}
@stevederico
stevederico / gist:1680080
Created January 26, 2012 00:48
UITextField Phone Number Formatter
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
SDTextFieldCell *phoneCell = (SDTextFieldCell*)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
if (textField != phoneCell.textField) {
return YES;
}
NSCharacterSet *nonNumberSet = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789."] invertedSet];
if (range.length == 1){
@stevederico
stevederico / ParseObjectWebForm.html
Created January 28, 2012 23:10
Parse Object Web Form
<!DOCTYPE html>
<!-- This is Simple Create Object Web Form for Parse.com-->
<!-- Step 1 Insert Parse APP ID -->
<!-- Step 2 Insert Parse REST API KEY -->
<!-- Step 3 Insert Parse Class Name -->
<!--Javascript POST Code from Kevin Lacker - http://blog.parse.com/2012/01/19/javascript-and-user-authentication-for-the-REST-API/ -->
<html>
@stevederico
stevederico / gist:1722199
Created February 2, 2012 07:35
Reachability checkForNetwork
- (BOOL)checkForNetwork {
//Check for Internet
Reachability *wifiReach = [Reachability reachabilityForInternetConnection];
NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
switch (netStatus) {
case NotReachable:{
@stevederico
stevederico / LayerCakeScript
Created April 17, 2012 16:49
LayerCake Rename Layers Photoshop Script
//LayerCake Rename PhotoShop Script by Steve Derico http://www.stevederico.com
Credits:
// Rename Layers - Adobe Photoshop Script
// Requirements: Adobe Photoshop CS, or higher
// Description: renames and numbers all layers in the active document (using the supplied name pattern)
// Author: Trevor Morris (trevor@morris-photographics.com)
// Website: http://morris-photographics.com/
// ============================================================================
// Installation:
@stevederico
stevederico / appledocHTML.mdown
Created June 1, 2012 06:45
AppleDoc HTML Only

appledoc --project-name SDKit --project-company "Bixby Apps" --company-id com.bixbyapps --verbose 6 --no-create-docset --create-html --output ./Documentation .

Get the Bookmarklet here: javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g%3Ef.fn.jquery||h(f)){c=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d==%22loaded%22||d==%22complete%22)){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,%221.3.2%22,function($,L){var%20output%20=%20'First%20Name,Last%20Name,Email,Phone,Title,Company';var%20companies%20=%20$(%22.x-grid3-col-COMPANYNAME%22);var%20titles%20=%20$(%22.x-grid3-col-TITLE%22);var%20names%20=%20$(%22.GMUAMTYCBK%20%3E%20.GMUAMTYCFI%22);%20%20%20%20%20%20%20%20var%20i%20=%200;%20%20%20%20%20%20%20%20names.each(function(index,value)%20{%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20name%20=%20$(this).text();%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20partsOfStr%20=%20name.split(',');%20%20%20%20%20%20%20%20%20

Episode 11

Summary

This week on Refactor.tv Sam and Steve talk about the new Apple Event. The guys cover news on iOS6, iBooks, 13" Retina Macbook, Mac Mini, and the new iMac.

Drinks

@refactortv us a drink you would like to see on the show.

@stevederico
stevederico / gist:3982673
Created October 30, 2012 20:09
Episode 12

Episode 12

Summary

This week on Refactor.tv Sam and Steve talk about the recent Apple Event. The guys cover news on iPad, the new iPad Mini, and a word based iOS game.

Drinks

@refactortv us a drink you would like to see on the show.