Skip to content

Instantly share code, notes, and snippets.

View ethanmick's full-sized avatar
🐺
Hello!

Ethan Mick ethanmick

🐺
Hello!
View GitHub Profile
- (IBAction)action:(UIButton *)sender;
{
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take Picture", @"Choose from Library", nil];
[sheet showInView:self.view];
}
@interface Class : Class <UIActionSheetDelegate, UIImagePickerControllerDelegate>
@end
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
/**
* Interesting enough, this method is called sometimes when authenticating with Facebook - but the page continuous to load, and
* does so sucessfully. The user can actually login. Other time though, the request may fail and be an actual failure.
*
* Because we don't really know the nature of this error, nor can we assume, we need to call the delegate and inform them of the error.
*/
NSLog(@"WebView error. This sometimes happens when the User is logging into a social network where cookies have been stored and is already logged in. %@", [error description]);
if ([self.delegate respondsToSelector:@selector(cmSocialLoginViewController:hadError:)]) {
[self.delegate cmSocialLoginViewController:self hadError:error];
@ethanmick
ethanmick / Game.m
Created January 4, 2014 16:30
Loading the Menu from Cocos2D
- (void)openMenu:(CCMenuItem *)item;
{
// UI KITTTTTTTTTT
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"DMMainMenu_iPhone" bundle:nil];
UIViewController *menu = [storyboard instantiateViewControllerWithIdentifier:@"DMMainMenuNavigationController"];
menu.modalPresentationStyle = UIModalPresentationFullScreen;
menu.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
if (menu) {
[[CCDirector sharedDirector] presentViewController:menu animated:YES completion:^{
[[CCDirector sharedDirector] pause];
@ethanmick
ethanmick / KPUser.h
Created April 18, 2013 18:30
Persisting a CMUser subclass.
//
// KPUser.h
// Header File
//
#import <CloudMine/CloudMine.h>
@interface KPUser : CMUser
@property (nonatomic, copy) NSString *firstName;
81883A97-D747-42C9-A005-136F44B0A2DC - String file contents
b0d5853a-7265-4de6-9121-058d2f7eca93 - String file contents
@ethanmick
ethanmick / gist:4560096
Created January 17, 2013 21:47
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Testing"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
@ethanmick
ethanmick / gist:4454310
Created January 4, 2013 17:19
My .emacs file on OS X
(require 'ido)
; ido settings
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@ethanmick
ethanmick / gist:4287692
Created December 14, 2012 18:59
Link social account using iOS Framework for CloudMine
// In MyLoginViewController.m
- (IBAction)loginWithSocial {
[_user loginWithSocialNetwork:CMSocialNetworkGithub viewController:self params:@{@"scope" : @"gist"} callback:^(CMUserAccountResult resultCode, NSArray *messages) {
if (resultCode == CMUserAccountLoginSucceeded) {
NSLog(@"We have successfully logged in!");
}
}];
}