Skip to content

Instantly share code, notes, and snippets.

- (NSDate *)midnightDateForDate:(NSDate *)date {
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)
fromDate:date];
[components setHour:0];
return [calendar dateFromComponents:components];
}
@LutherBaker
LutherBaker / 1_appium.sh
Last active May 24, 2022 23:22
Appium Cheatsheet
##
## minimize 'sudo' as much as possible
##
##
## note that this file is not meant to be RUN directly
## - consider this specific file simply a list of steps to complete
## - ie: copy and paste parts of this to your command line!
##
// http://stackoverflow.com/questions/13122210/dynamically-format-a-float-in-a-nsstring
int precision = 2;
NSString *whatever=[NSString stringWithFormat:@"My float: %.*f", precision,aFloat];
// Asterisk in place of 2^^ ^^^^^^^^^ int variable
@LutherBaker
LutherBaker / ios-cheatsheet.m
Last active August 29, 2015 14:01
iOS Cheatsheet
//
// AppDelegate
//
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *root = nil; // replace this line!
self.window.rootViewController = root;
[self.window makeKeyAndVisible];
return YES;
##
## Most Audio Units install to this location:
##
cd /Library/Audio/Plug-Ins/Components
##
## Other Audio Units install to:
##
cd ~/Library/Audio/Plug-Ins/Components
@LutherBaker
LutherBaker / objectivec-cheatsheet.m
Created May 26, 2014 17:00
Objective-C Cheatsheet
//
// Sharing an instance
//
+ (id)sharedInstance {
static SharedInstanceClass *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[self alloc] init];
});
@LutherBaker
LutherBaker / bash_profile.sh
Last active August 29, 2015 14:01
Git Cheatsheet
. ~/.bash_colors
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
export PS1=$txtred'[\W]'$txtylw'$(__git_ps1)'$txtrst' \$ '
fi
export GIT_PS1_SHOWUPSTREAM=auto
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
https://github.com/kif-framework/KIF
http://cocoadocs.org/docsets/KIF/2.0.0/
http://cocoadocs.org/docsets/KIF/2.0.0/Classes/KIFUITestActor.html#//api/name/waitForViewWithAccessibilityLabel:
https://github.com/kif-framework/KIF/blob/master/Documentation/Examples/Testable/Acceptance%20Tests/IntegrationTestCases.m
The first thing you will want to do is set up a test target you will be using for KIF.
## http://www.ruby-doc.org/gems/docs/d/davidtrogers-cucumber-0.6.2/Cucumber/Ast/Table.html
@LutherBaker
LutherBaker / .bash_colors.sh
Last active August 29, 2015 14:02
Apple Terminal
txtblk='\[\e[0;30m\]' # Black - Regular
txtred='\[\e[0;31m\]' # Red
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
bldblk='\[\e[1;30m\]' # Black - Bold
bldred='\[\e[1;31m\]' # Red