This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# +----------------------------------------------------------------------+ | |
# | | | |
# | Mount the root file system / with the option noatime | | |
# | | | |
# | By Philipp Klaus <http://blog.philippklaus.de> | | |
# | Tip found on <http://blogs.nullvision.com/?p=275> | | |
# | | | |
# +----------------------------------------------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple implementation (not thread-safe) | |
+ (Singleton *) sharedSingleton | |
{ | |
static Singleton *instance; | |
if (nil == instance) | |
{ | |
instance = [self new]; | |
} | |
return instance; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "tgmath.h" | |
CGRect ADVRectScaleToSize(CGRect sourceRect, CGSize targetSize, UIViewContentMode contentMode) | |
{ | |
CGSize sourceSize = sourceRect.size; | |
CGFloat horizontalRatio = targetSize.width / sourceSize.width; | |
CGFloat verticalRatio = targetSize.height / sourceSize.height; | |
CGFloat ratio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thought #1 | |
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
{ | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Warc-performSelector-leaks" | |
[self performSelector:NSSelectorFromString(segue.identifier) | |
withObject:segue.destinationViewController]; | |
#pragma clang diagnostic pop | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIViewController (ADVOverlay) | |
@property (nonatomic, readonly) UIViewController *overlayViewController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import lldb | |
import shlex | |
def mem_location(arch, index): | |
index = int(index) | |
return { | |
'arm' : ("$r%d" % (index)) if (index < 4) else ("$sp+%d" % (index - 4)), | |
'armv7' : ("$r%d" % (index)) if (index < 4) else ("$sp+%d" % (index - 4)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Copyright © 2013 Yuri Kotov | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSUserDefaults (ADVKeyedSubscript) | |
- (id) objectForKeyedSubscript:(NSString *)key; | |
- (void) setObject:(id)object forKeyedSubscript:(NSString *)key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fileName = prompt('Image name', 'image'); | |
if (null != fileName) | |
{ | |
var selection = activeDocument.selection; | |
try | |
{ | |
selection.copy(true); | |
} | |
catch (error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSObject (ADVCasting) | |
+ (instancetype) staticCast:(id)from; | |
+ (instancetype) dynamicCast:(id)from; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+[NSObject load] | |
__attribute__((constructor)) | |
main() | |
+[NSObject initialize] | |
... | |
atexit() | |
__attribute__((destructor)) |