Skip to content

Instantly share code, notes, and snippets.

View ethanmick's full-sized avatar
🐺
Hello!

Ethan Mick ethanmick

🐺
Hello!
View GitHub Profile
@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;
@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];
- (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];
@interface Class : Class <UIActionSheetDelegate, UIImagePickerControllerDelegate>
@end
- (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];
}
@ethanmick
ethanmick / 2048.applescript
Last active August 29, 2015 13:57
A script to play 2048 on Chrome.
activate application "Google Chrome"
delay 1.0 -- time to release modifier keys if the script is run with a keyboard shortcut
tell application "System Events"
repeat 100 times
set rand to (random number from 123 to 126)
key code rand
delay 0.2
end repeat
end tell
Process: Xcoverage [9811]
Path: /Applications/Xcoverage.app/Contents/MacOS/Xcoverage
Identifier: com.MattRajca.Xcoverage
Version: 1.0.5 (8)
Code Type: X86-64 (Native)
Parent Process: launchd [148]
Responsible: Xcoverage [9811]
User ID: 501
Date/Time: 2014-04-18 13:07:48.222 -0400
// header.h
@interface CMTestEncoderNSCoding : NSObject <NSCoding>
@property (nonatomic, copy) NSString *aString;
@property (nonatomic, assign) NSInteger anInt;
@end
@interface CMTestEncoderNSCodingParent : CMObject
@ethanmick
ethanmick / delete_data.rb
Created April 22, 2014 22:53
Give an App ID and the master token - delete's all users and optionally all app data as well.
#
# Requires you to run 'gem install httparty'
#
require 'httparty'
def main
appId = ARGV[0]
masterKey = ARGV[1]
delete_data = ARGV[2] ? ARGV[2] == "true" : false

Keybase proof

I hereby claim:

  • I am ethanmick on github.
  • I am ethanmick (https://keybase.io/ethanmick) on keybase.
  • I have a public key ASC51TgU3L5pj5QUGXYWQvmVGgH6mnByjlMze9_AMe4C0wo

To claim this, I am signing this object: