Skip to content

Instantly share code, notes, and snippets.

View testzugang's full-sized avatar

Meinhard Gredig testzugang

View GitHub Profile
@MattesGroeger
MattesGroeger / Rakefile
Last active January 4, 2016 19:09
Run commands from Ruby (e.g. Rakefile) with real time output and exiting on non-0 exit codes.
desc 'Build'
task :build do
run("xbuild Project.sln", "Build failed")
run("nunit-console Tests/bin/Debug/Project-Tests.dll", "Tests failed")
run("mono Tests/vendor/NSpecRunner.exe Tests/bin/Debug/Project-Tests.dll", "Specs failed")
end
task :default => :demo
# This is the important method
@epologee
epologee / NSBundle+TTTOverrideLanguage.h
Created October 11, 2013 19:26
Use method swizzling to change both language and locale at runtime, to use in your unit tests.
#import <Foundation/Foundation.h>
@interface NSBundle (TTTOverrideLanguage)
+ (void)ttt_overrideLanguage:(NSString *)language;
+ (void)ttt_resetLanguage;
@end
@MattesGroeger
MattesGroeger / UIImageView+Mask.h
Last active December 17, 2015 10:59
With this category of `UIImageView` you can apply a mask (grey-scale jpg) onto a given image. The mask is then applied on that existing image. With this technique you can use 2 compressed JPG's (not transparent image + mask) rather than one big PNG file.
#import <Foundation/Foundation.h>
@interface UIImageView (Mask)
- (void)applyMask:(NSString *)maskName;
@end
@ain
ain / mysqldumpgz
Last active December 16, 2015 02:28
mysqldump a database to gzip
#!/bin/bash
usage="Usage: mysqldumpgz database_name username"
err[1]="Invalid command"
# Check for database name argument
if [ -z "$1" ]
then
echo ${err[1]}
@alex-cellcity
alex-cellcity / Version.m
Created May 30, 2011 04:55
Runtime iOS Version Checking
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)