Skip to content

Instantly share code, notes, and snippets.

View Blackjacx's full-sized avatar
👨‍💻
Coding

Stefan Herold Blackjacx

👨‍💻
Coding
View GitHub Profile
@Blackjacx
Blackjacx / gist:7c51ece9a6ba513ec23c
Last active August 29, 2015 14:12
Core Data Managed Object Creation using Magical Record
/*
Create a temporary context with the default context as parent.
The state of the default context will be available in the temporary context.
If you are really sure you want to save the object you don't need to create a temporary context.
You can use MR_defaultContext in this case.
*/
NSManagedObjectContext *tempContext = [NSManagedObjectContext MR_contextWithParent:[NSManagedObjectContext MR_defaultContext]];
/*
Perform operations on the temporary context on the
@Blackjacx
Blackjacx / LoadingHTMLResourceIntoWebView
Created May 15, 2013 15:04
Loading HTML Resource Into UIWebView
- (void)showHTMLRessourceInWebView:(BOOL)animated
{
// Load html data from main bundle
NSString * filePath = [[NSBundle mainBundle]
pathForResource:@"<RESOURCE_NAME>"
ofType:@"html"];
NSData * htmlData = [NSData dataWithContentsOfFile:filePath];
if( !htmlData ) {