Skip to content

Instantly share code, notes, and snippets.

View rock88's full-sized avatar

Andrey K rock88

  • rock88dev
  • Cyprus
View GitHub Profile
@rock88
rock88 / README.md
Last active March 31, 2024 19:29
Use Xcode 13.3 on macOS Big Sur

Xcode 13.3 required macOS 12.0 or later, but with this tips you can use it on a macOS 11 (11.6.1 for me). Xcode 13.2.1 should be installed anyway (/Applications/Xcode.app).

Install Xcode 13.3 on macOS Big Sur

  1. Download Xcode 13.3 from Apple Developer Portal;
  2. Unpack it and move to /Applications;
  3. Right click on Xcode_13.3.app and select Show Package Contents;
  4. Open Contents/Info.plist;
  5. Set your current macOS version to Minimum system version (I just set 11.0).
@rock88
rock88 / shell
Last active August 24, 2016 09:20
Get git commits by specific user name & after specific date
git log --author=Andrey --after="2016-08-01 00:00" > ~/Documents/log.txt
git log --author=Andrey --after="2016-08-12 00:00" --pretty='format:%ad %B' > ~/Documents/log.txt
@rock88
rock88 / main.m
Created June 3, 2016 10:56
Enum to NSString macro
#define BEGIN_DEFINE_TYPE(type) NSString* NSStringFrom##type(type var) {
#define DEFINE_TYPE_VALUE(value) if (var == value) return @#value;
#define END_DEFINE_TYPE() return @"Unknown type"; }
typedef NS_ENUM(NSInteger, MyType) {
MyTypeTest,
MyTypeAppstore,
MyTypeRelease
};
void Swizzle(Class class, SEL selector, void(^block)())
{
Method method = class_getInstanceMethod(class, selector);
//IMP imp = method_getImplementation(method);
method_setImplementation(method, imp_implementationWithBlock(block));
}
@rock88
rock88 / gist:31a5cb3bae89ed07ae43
Last active June 28, 2018 02:01
Pixel formats supported for bitmap graphics contexts

From https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html#//apple_ref/doc/uid/TP30001066-CH203-BCIBHHBB


CS Pixel format and bitmap information constants Availability
Gray 8 bpp, 8 bpc, kCGImageAlphaNone Mac OS X, iOS
Gray 8 bpp, 8 bpc, kCGImageAlphaOnly Mac OS X, iOS
Gray 16 bpp, 16 bpc, kCGImageAlphaNone Mac OS X
Gray 32 bpp, 32 bpc, kCGImageAlphaNone OR kCGBitmapFloatComponents Mac OS X
RGB 16 bpp, 5 bpc, kCGImageAlphaNoneSkipFirst Mac OS X, iOS
RGB 32 bpp, 8 bpc, kCGImageAlphaNoneSkipFirst Mac OS X, iOS
@rock88
rock88 / gist:c3e45880e636a70bb271
Last active June 17, 2016 06:34
Git HEAD detached fix
// for find commit hash from HEAD
git reflog
// commit all changes and remember last commit hash
git checkout your_branch
git reset --hard your_hash
- (void)share:(UIImage *)immagine completion:(void(^)(NSError* error))completion
{
[FBRequestConnection startWithGraphPath:@"/me/albums" parameters:nil HTTPMethod:@"GET" completionHandler:^(FBRequestConnection *connection,i d result, NSError *error)
{
if (!error)
{
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:UIImagePNGRepresentation(immagine) forKey:@"picture"];
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"/%@/photos", result] parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection,result,NSError *error)
@interface Camera : NSObject
@property (nonatomic, strong) AVCaptureStillImageOutput* stillImageOutput;
@property (nonatomic,strong) AVCaptureSession *session;
- (AVCaptureDevice *)frontFacingCameraIfAvailable;
- (void)setupCaptureSession;
- (void)captureWithBlock:(void(^)(UIImage* block))block;
@end