Skip to content

Instantly share code, notes, and snippets.

@rabinjoshi
rabinjoshi / RJViewController.m
Created December 9, 2012 20:37
Loading content in a WebView using NSURLConnection
@implementation RJViewController {
__weak IBOutlet UIWebView *_webView;
NSURLConnection *_urlConnection;
NSMutableData *_receivedData;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *urlString = @"http://google.com";
@rabinjoshi
rabinjoshi / RJViewController.m
Created December 9, 2012 20:32
Loading a url directly in a WebView
@implementation RJViewController
{
__weak IBOutlet UIWebView *_webView;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *urlString = @"http://google.com";
NSURL *url = [NSURL URLWithString:urlString];
@rabinjoshi
rabinjoshi / InterestingnessTableViewController.m
Created November 22, 2012 21:45
Interestingness - Version 3
//
// InterestingnessTableViewController.m
// Interestingness - Version 3
//
// Created by Danton Chin on 3/24/10.
// Copyright 2010 http://iphonedeveloperjournal.com/. All rights reserved.
//
#import "InterestingnessTableViewController.h"
@rabinjoshi
rabinjoshi / InterestingnessTableViewController.m
Created November 22, 2012 21:17
Interestingness - Version 2
//
// InterestingnessTableViewController.m
// Interestingness - Version 2
//
// Created by Danton Chin on 3/24/10.
// Copyright 2010 http://iphonedeveloperjournal.com/. All rights reserved.
//
#import "InterestingnessTableViewController.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
struct sigaction newSignalAction; //create the signal action structure
memset(&newSignalAction, 0, sizeof(newSignalAction)); //initialize the signal action structure
newSignalAction.sa_handler = &signalHandler; //set signalHandler as the handler in the signal action structure
sigaction(SIGABRT, &newSignalAction, NULL); //set SignalHandler as the handlers for SIGABRT, SIGILL and SIGBUS
sigaction(SIGILL, &newSignalAction, NULL);
//
// main.m
// Archiving3
//
// Created by Rabin Joshi on 6/18/11.
// Copyright 2011 Techgene. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Foo.h"
//
// main.m
// Archiving3
//
// Created by Rabin Joshi on 6/18/11.
// Copyright 2011 Techgene. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Foo.h"
@rabinjoshi
rabinjoshi / Archiving
Created June 18, 2011 14:51
Archiving objects
//
// main.m
// Archiving3
//
// Created by Rabin Joshi on 6/18/11.
// Copyright 2011 Techgene. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Foo.h"
@rabinjoshi
rabinjoshi / Archiving
Created June 18, 2011 05:04
Archiving objects
NSDictionary *glossary = [NSDictionary dictionaryWithObjectsAndKeys:
@"A class defined so other classes can inherit from it.", @"abstract class",
@"To implement all the methods defined in a protocol", @"adopt",
@"Storing an object for later use. ", @"archiving",
nil
];
// Storing
if ([glossary writeToFile: @"/Users/rabinjoshi/Desktop/glossary.plist" atomically: YES] == NO)