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 "DDXML.h"; | |
#import "DDXMLNode+HTML.h" | |
#import "DDXMLDocument+HTML.h" |
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
Ti.include( 'includes/tiframework.js' ); | |
var $ = TiFramework; | |
var main_window = $('currentWin'); | |
main_window.focus(function() { | |
// Create the label | |
var label = $('label') | |
// Set some options |
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 validateForm() { | |
var formIsValid = true; | |
function enforceTextFieldMinLength(field, minLength) { | |
if (!field.value || field.value.length < minLength) { | |
formIsValid = false; | |
} | |
} | |
function enforceLabelHasText(label) { | |
if (!label.text) { | |
formIsValid = false; |
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
// testend on iOS | |
var win = Ti.UI.createWindow(); | |
win.open(); | |
// the desired image widths | |
var imageSizes = [1200,800,600,200]; |
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 <libkern/OSAtomic.h> | |
#import <dispatch/dispatch.h> | |
#import <objc/runtime.h> | |
@implementation MySingleton | |
+ (void) load | |
{ | |
// check for weak-linked libdispatch symbols | |
if ( dispatch_queue_create != 0 ) |
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
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
// Code to run asynchronously | |
dispatch_async( dispatch_get_main_queue(), ^{ | |
// Code to run on main thread | |
}); | |
}); |
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
@interface ExtendedManagedObject : NSManagedObject { | |
BOOL traversed; | |
} | |
@property (nonatomic, assign) BOOL traversed; | |
- (NSDictionary*) toDictionary; | |
- (void) populateFromDictionary:(NSDictionary*)dict; | |
+ (ExtendedManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict | |
inContext:(NSManagedObjectContext*)context; |
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
/* | |
Source: Apple Developer - Understanding iOS View Compositing | |
*/ | |
// setup the layer | |
CALayer *layer = view.layer; | |
layer.bounds = sublayer_bounds; | |
layer.backgroundColor = random_color(); | |
// set the shadow properties on the layer |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer