Skip to content

Instantly share code, notes, and snippets.

@jpsim
jpsim / Export for iOS.jsx
Created August 19, 2012 22:16
ExtendScript iOS export
// This script makes a copy merged based on selection (or entire canvas),
// creates a new doc based on rounding the merged size to even dimensions,
// pastes it into a new doc, then exports it for both retina and non-retina iOS devices.
//
// Written on August 19, 2012 by JP Simard, Magnetic Bear Studios Inc.
exportForIOS();
function exportForIOS() {
// save document state
@jpsim
jpsim / Export for Android.jsx
Created September 7, 2012 15:23
ExtendScript for Android export
// This script makes a copy merged based on selection (or entire canvas),
// pastes it into a new doc, then exports it for Android in 320dpi, 240dpi, 160dpi, 120dpi
//
// Written by August 19, 2012 by JP Simard, Magnetic Bear Studios Inc.
exportForAndroid();
function exportForAndroid() {
// save document state
var initialState = activeDocument.activeHistoryState;
@jpsim
jpsim / iOS Development Resources.md
Last active December 12, 2015 06:19
List of useful resources for iOS devs

iOS Development Resources

Development

  • Cocoapods – Great dependency manager for iOS and Mac development
  • MagicalRecord – Super easy Core Data
  • AFNetworking – Best networking library for iOS out there
  • Cocoa Controls – Good site to find open source projects to help speed up your development

Debugging

- (double)convertFarenheitToCelsius:(double)farenheit {
double celsius = 0;
celsius = (5/9) * (farenheit - 32);
return celsius;
}
- (double)convertCelsiusToFarenheit:(double)celsius {
double farenheit = 0;
farenheit = celsius * (9/5) + 32;
return farenheit;
}
- (void)setUp {
[super setUp];
controller = [[ViewController alloc] init];
// Set-up code here.
}
- (void)tearDown {
// Tear-down code here.
[super tearDown];
controller = nil;
}
- (void)testCelsiusEqualsFarenheitAtNegativeForty {
double celsiusResult = 0;
double farenheitResult = 0;
celsiusResult = [controller convertFarenheithToCelsius:-40];
farenheitResult = [controller convertCelsiusToFarenheit:-40];
STAssertEquals(celsiusResult, farenheitResult, @"these should be the same");
}
- (void)testThatThirtyTwoFarenheitEqualsZeroCelsius {
double celsiusResult = [controller convertFarenheithToCelsius:32];
double farenheitResult = [controller convertCelsiusToFarenheit:0];
STAssertEquals(celsiusResult, 0, @"should be zero");
STAssertEquals(farenheitResult, 32, @"should equal 32");
}
- (void)testThatHundredCelsiusIsTwoTwelveFarenheit {
double farenheitResult = [controller convertCelsiusToFarenheit:100];
double celsiusResult = [controller convertFarenheithToCelsius:212];
STAssertEquals(farenheitResult, 212, @"should equal 212");
STAssertEquals(celsiusResult, 100, @"should equal 100");
}