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 / 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 / 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>

Episode 35

Summary

This week on Refactor.tv Sam and Steve talk about the Facebook Home, Blink, and iOS7.

Drinks

@refactortv your favorite cocktails.

@stevederico
stevederico / gist:5316737
Last active December 15, 2015 20:09
How to Add AFIncrementalStore to an Existing Project

How to Add AFIncrementalStore to an Existing Project

Add dependencies without Cocoapods

  • Add Core Data
  • Add Mobile Core Services
  • Add System Configuration
  • Add AFIncrementalStore
  • Add AFNetworking
  • Add InflectorKit

Episode 32

Summary

This week on Refactor.tv Sam and Steve talk about the Kickoff, Mailbox, and Hue.

Drinks

@refactortv your favorite cocktails.

@stevederico
stevederico / gist:4751596
Last active December 12, 2015 09:29
application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:8 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
[NSURLCache setSharedURLCache:URLCache];
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
**SDScaffoldIndexViewController *scaffoldViewController = [[SDScaffoldIndexViewController alloc] initWithEntityName:@"ENTITYNAME" sortBy:@"PROPERTY" context:self.managedObjectContext];**
@stevederico
stevederico / gist:4676452
Last active December 11, 2015 23:28
AFNetworking + AFIncrementalStore + SDScaffoldKit = Client/Server App

AFNetworking + AFIncrementalStore + SDScaffoldKit = Client/Server App

SDScaffoldKit with AFNetworking Template

These are the exact steps needed to take to create an syncing client-server app in 3 minutes. Watch this video for a complete demo. You will need to have CocoaPods Installed on your machine.

  1. Install CocoaPods
  2. Create New Project with AFNetworking Xcode Template
  3. Close current project. cd to PROJECTNAME directory then
  4. Run pod install