Skip to content

Instantly share code, notes, and snippets.

View ethanmick's full-sized avatar
🐺
Hello!

Ethan Mick ethanmick

🐺
Hello!
View GitHub Profile
- (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
@ethanmick
ethanmick / gist:1443575
Created December 7, 2011 16:56
Logs from my app.
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 15771.
Pending breakpoint 1 - "objc_exception_throw" resolved
2011-12-07 11:55:15.038 Magikarp[15771:fb03] I restkit.network.cache:RKRequestCache.m:350 Invalidating cache at path: /Users/ethan/Library/Application Support/iPhone Simulator/5.0/Applications/7FAB1636-5E1D-40A9-98B4-0058A717907C/Library/Caches/RKClientRequestCache-129.21.140.120/SessionStore
@ethanmick
ethanmick / test_file1.txt
Created January 10, 2012 16:28
Testing 2
01/01/1899,01/01/1900 # First year too low #Ethan Mick - spent 359083590 seconds on this assignment
01/01/1900,01/01/1899 # Second year too low
01/01/10000,01/02/1901 # First year too high
01/01/1900,01/01/10000 # Second year too high
013/01/1900,01/01/1901 # invalid first month
01/01/1900,013/01/1901 # invalid second month
01/0144/1900,01/01/1901 # invalid first day
01/01/1900,01/0144/1901 # invalid second day
Comment as the first part of the line, 01/01/1900,01/02/1900
01-01-1900,01-02-1900 # different characters for separation
2012-01-21 21:01:28.745 Magikarp[34407:fb03] Posting list with user: ethan@infinitydd.com and Epsilonn
2012-01-21 21:01:28.747 Magikarp[34407:fb03] T restkit.network.queue:RKRequestQueue.m:319 Request <RKManagedObjectLoader: 0x82e3b40> added to queue <RKRequestQueue: 0x828e180 name=(null) suspended=NO requestCount=0 loadingCount=0/5>
2012-01-21 21:01:28.747 Magikarp[34407:fb03] T restkit.network.queue:RKRequestQueue.m:265 Processing request <RKManagedObjectLoader: 0x82e3b40> in queue <RKRequestQueue: 0x828e180 name=(null) suspended=NO requestCount=1 loadingCount=0/5>
2012-01-21 21:01:28.748 Magikarp[34407:fb03] T restkit.network.queue:RKRequestQueue.m:189 Loading count increasing from 0 to 1. Firing requestQueueDidBeginLoading
2012-01-21 21:01:28.749 Magikarp[34407:fb03] T restkit.network.queue:RKRequestQueue.m:216 Loading count set to 1 for queue <RKRequestQueue: 0x828e180 name=(null) suspended=NO requestCount=1 loadingCount=0/5>
2012-01-21 21:01:28.750 Magikarp[34407:fb03] T restkit.network.cache:RKRequestC