Skip to content

Instantly share code, notes, and snippets.

View beny's full-sized avatar
:octocat:
🆙 and 🏃‍♂️

Ondra Beneš beny

:octocat:
🆙 and 🏃‍♂️
View GitHub Profile
@beny
beny / gist:6077418
Last active December 20, 2015 05:19
Simple specific NSNotification logger
void NotificationLogger(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
NSString *notificationName = (__bridge NSString *)name;
NSRange prefixRange = [notificationName rangeOfString:@"OB"];
NSArray *excludeNotifications = @[@"OBNotInterestingNotification"];
if (prefixRange.location != NSNotFound && prefixRange.length != 0) {]) {
NSLog(@"Notification send %@ with userInfo %@", name, userInfo);
}
}
@beny
beny / gist:7037968
Last active December 25, 2015 20:49
iOS crash logs locations

OS X

~/Library/Logs/CrashReporter/MobileDevice/<your iPhone’s name>/

Windows XP

C:\Documents and Settings\Application Data\Apple computer\Logs\CrashReporter\<your iPhone’s name>\

Windows Vista

C:\Users\AppData\Roaming\Apple computer\Logs\CrashReporter\MobileDevice\<your iPhone’s name>\

Windows 7

@beny
beny / gist:8313934
Last active January 2, 2016 13:59
LLDB tips

Breakpoints

breakpoint set -s method: - create breakpoint for all methods with selector method: po [(CALayer *)[[[[UIApplication sharedApplication] windows] objectAtIndex:0] layer] setSpeed:.1f]; - slow down all animations on device

@beny
beny / gist:8313959
Last active March 14, 2022 11:41
Xcode tips

Core Data

  • -com.apple.CoreData.SQLDebug 1-3 - print all SQL queries called by Core Data
    • -com.apple.CoreData.Logging.stderr 1-3 - needed alongside with the SQLDebug from iOS 10+ because of new logging system, more on that in changelog
  • -com.apple.CoreData.SyntaxtColoredLogging YES - probably syntax colored logging (not tried)
  • -com.apple.CoreData.SQLiteDebugSynchronous 1 - preference controls some aspects of the SQLite store. See the "Configuring a SQLite Store's Save Behavior" section of the Core Data Programming Guide for details
  • -com.apple.CoreData.SQLiteIntegrityCheck 1 - the SQLite store does extra integrity checking
  • -com.apple.CoreData.MigrationDebug 1 - Core Data will log information about exceptional cases as it migrates data
  • -com.apple.CoreData.ThreadingDebug - preference enables assertions to enforce Core Data's multi-threading policy. It is a number, where incre
@beny
beny / gist:8502567
Created January 19, 2014 09:45
[UIImage preferredStatusBarStyle] If you have an image directly under your StatusBar (without a NavigationBar under it) then you should have the preferredStatusBar for that ViewController update to reflect the average color value for that image. ie. a dark image should have white text and a light image black text. source https://coderwall.com/p/…
@interface UIImage (mxcl)
@end
@implementation UIImage (mxcl)
- (UIStatusBarStyle)preferredStatusBarStyle {
UIGraphicsBeginImageContextWithOptions((CGSize){1, 1}, NO, 0.0);
[self drawInRect:(CGRect){0, 0, 1, 1}];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
@beny
beny / tm_properties
Created January 22, 2014 20:23
TextMate 2 properties file
scmStatus = false
invisiblesMap = "~ \t┊"
TM_RUBY = "$HOME/.rbenv/shims/ruby"
PATH = "$HOME/.rbenv/bin:$PATH"
fontSmoothing = true
excludeFiles = "*.{png,so,pyc,o,scssc}"
@beny
beny / gist:9617633
Last active August 29, 2015 13:57
Singular Value Decomposion - Ruby's GSL vs Python's NumPy
# in Ruby with GSL
>> m
=> GSL::Matrix
[ 1.000e+00 -1.000e+00
1.000e+00 0.000e+00
1.000e+00 1.000e+00 ]
>> m.svd
=> [GSL::Linalg::SV::UMatrix
[ -5.774e-01 7.071e-01
-5.774e-01 0.000e+00
@beny
beny / gist:11246371
Created April 24, 2014 08:24
Gitbox push config error
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 31 in /Users/myuser/.gitconfig
@beny
beny / okruhy.txt
Last active August 29, 2015 14:01
Tématické okruhy MBI
init
@beny
beny / gist:000ea1cc869c1ac7d986
Created June 4, 2015 14:26
Objective-C inline functions & macros
static inline BOOL isEmpty(id thing) {
return (thing == nil)
|| ([thing respondsToSelector:@selector(length)] && [thing length] == 0)
|| ([thing respondsToSelector:@selector(count)] && [thing count] == 0)
|| ([thing isKindOfClass:[NSNull class]]);
}