Skip to content

Instantly share code, notes, and snippets.

View Akhrameev's full-sized avatar

Pavel Akhrameev Akhrameev

  • Picsart
  • Yerevan, Armenia
View GitHub Profile
TARGET="$PROJECT_DIR/$EXECUTABLE_NAME/$EXECUTABLE_NAME-Info.plist"
echo $TARGET
if [ ! -f "$TARGET" ]; then
echo "missing file $TARGET"
exit 1;
fi
# the perl regex splits out the last part of a build number (ie: 1.1.1) and increments it by one
# if you have a build number that is more than 3 components, add a '\.\d+' into the first part of the regex.
//
// CellBackgroundView.h
//
//
#import <UIKit/UIKit.h>
typedef enum {
CellPositionTop,
CellPositionMiddle,
@Akhrameev
Akhrameev / NSNotificationCenter+AllObservers.h
Last active August 29, 2015 14:02 — forked from 0xced/NSNotificationCenter+AllObservers.m
removeObserver swizzling added + SWIZZLE_NSNOTIFICATIONCENTER + separate .h and .m files
#import <Foundation/Foundation.h>
@interface NSNotificationCenter (AllObservers)
- (NSSet *) my_observersForNotificationName:(NSString *)notificationName;
@end
@interface UIImage(ImmediateLoad)
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path;
@end
@implementation UIImage(ImmediateLoad)
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path {
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
- (UIView *) huntedSubviewWithClassName: (NSString *) className
{
if ([[[self class] description] isEqualToString: className])
{
return self;
}
for (UIView *subview in self.subviews)
{
UIView *huntedSubview = [subview huntedSubviewWithClassName: className];
@Akhrameev
Akhrameev / AVAsset+VideoOrientation.h
Created October 19, 2016 05:04 — forked from luca-bernardi/AVAsset+VideoOrientation.h
Find the video orientation of an AVAsset. (Useful if you need to send the video to a remote server)
//
// AVAsset+VideoOrientation.h
//
// Created by Luca Bernardi on 19/09/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
typedef enum {
LBVideoOrientationUp, //Device starts recording in Portrait
@Akhrameev
Akhrameev / iOS 7 dynamic font mappings
Created November 15, 2017 07:37 — forked from nuthatch/iOS 7 dynamic font mappings
What is UIFontTextStyleHeadline *really*? Dump out preferredFontForTextStyle for UIFontTextStyleHeadline, UIFontTextStyleSubheadline, UIFontTextStyleBody, UIFontTextStyleFootnote, UIFontTextStyleCaption1, UIFontTextStyleCaption2 to examine the font name, weight, and point size.
+ (void)describePreferredFonts
{
static NSArray *textStyles;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
textStyles = @[UIFontTextStyleHeadline,
UIFontTextStyleSubheadline,
UIFontTextStyleBody,
UIFontTextStyleFootnote,
UIFontTextStyleCaption1,
@Akhrameev
Akhrameev / HKWUIDeviceHardware.h
Created December 19, 2017 15:55 — forked from jamesstout/HKWUIDeviceHardware.h
Determine iOS device being used and other device info
//
// HKWUIDeviceHardware.h
//
#import <Foundation/Foundation.h>
@interface HKWUIDeviceHardware : NSObject
- (NSString *) platform2;
- (NSString *) platformString;
@Akhrameev
Akhrameev / part1.m
Created May 16, 2018 12:12 — forked from enigmaticape/part1.m
You want to use NSObject performSelector with multiple parameters, but you can't ? (1)
- ( id ) methodWithOneParam:( id ) theParam {
// Do amazing stuff
return @"Srsly, Amazing!";
}
- ( id ) methodWithFirst:( id ) firstParam
andSecond:( id ) secondParam
{
// Do doubly amazing stuff
@Akhrameev
Akhrameev / OSTypedEnum.swift
Created June 26, 2020 11:12 — forked from danielpi/OSTypedEnum.swift
Extension to AVCaptureVideoDataOutput and an enum to represent OSType CVPixelFormatType data
extension AVCaptureVideoDataOutput {
var availableVideoCVPixelFormatTypedEnums: [OSTypedEnum] {
let availablePixelFormatDescriptions: Array<OSType> = self.availableVideoCVPixelFormatTypes as! Array<OSType>
let availablePixelFormats: Array<OSTypedEnum> = availablePixelFormatDescriptions.map { OSTypedEnum(rawValue: $0)! }
return availablePixelFormats
}
}
enum OSTypedEnum: OSType {
case monochrome1 = 1