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
public String parseInputStream(InputStream inputStream) throws Exception | |
{ | |
XmlPullParser parser = Xml.newPullParser(); | |
parser.setInput(inputStream, null); | |
int eventType = parser.getEventType(); | |
while (eventType != XmlPullParser.END_DOCUMENT) { | |
switch (eventType){ | |
case XmlPullParser.START_DOCUMENT: |
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 UIView (UIView_Snapshots) | |
// Take image snapshots of the current state of a view. | |
// Use the background color of the superview if you have rounded corners | |
// If background color is nil the background will be treated as transparent | |
- (UIImage*) imageOfViewUsingBackgroundColor:(UIColor*)backgroundColorOrNil; | |
// Will save to the documents directory as XXXX.png | |
- (void) saveImageOfViewToPNGNamed:(NSString*)fileNameMinusExtension usingBackgroundColor:(UIColor*)backgroundColorOrNil; |
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
-- Erica Sadun, http://ericasadun.com | |
-- iPhone Developer's Cookbook, 3.0 Edition | |
-- BSD License, Use at your own risk | |
-- Adapted by Rob Saunders to also replace embeded profiles | |
-- | |
-- | |
-- save in Script Editor as Application | |
-- drag files to its icon in Finder | |
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
package uk.co.digitaljigsaw.utils; | |
import java.util.Calendar; | |
import java.util.Date; | |
import android.R.string; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
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+ImageSplitting.h | |
// Test | |
// | |
// Created by Robert Saunders on 03/02/2012. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import <UIKit/UIKit.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
// View controller is a subclass of GLKViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
self.eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; | |
self.ciContext = [CIContext | |
contextWithEAGLContext:self.eaglContext |
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
// | |
// UIView+ViewArranging.h | |
// Created by on 15/05/2012. | |
// | |
#import <UIKit/UIKit.h> | |
typedef enum { | |
ViewArrangingDirectionHorizontal, | |
ViewArrangingDirectionVertical |
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
+ (NSString *)htmlFromBodyString:(NSString *)htmlBodyString | |
textFont:(UIFont *)font | |
textColor:(UIColor *)textColor | |
{ | |
int numComponents = CGColorGetNumberOfComponents([textColor CGColor]); | |
NSAssert(numComponents == 4 || numComponents == 2, @"Unsupported color format"); | |
// E.g. FF00A5 | |
NSString *colorHexString = nil; |
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
// For NSString to NSDate to parse server dates in the full ISO 8601 format | |
// E.g. 2014-02-11T10:22:46+00:00 | |
+ (NSDateFormatter *) iso8601FullDateFromatter | |
{ | |
static NSDateFormatter * dateFormatter; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
dateFormatter = [[NSDateFormatter alloc] init]; |
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) showConfirmationAlert | |
{ | |
// A quick and dirty popup, displayed only once | |
if (![[NSUserDefaults standardUserDefaults] objectForKey:@"HasSeenPopup"]) | |
{ | |
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Question" | |
message:@"Do you like cats?" | |
delegate:self | |
cancelButtonTitle:@"No" | |
otherButtonTitles:@"Yes",nil]; |
NewerOlder