Skip to content

Instantly share code, notes, and snippets.

View Kirow's full-sized avatar

Kirill Serebriakov Kirow

View GitHub Profile
@Kirow
Kirow / Available Fonts.m
Last active August 29, 2015 14:01
Enumerate Fonts available in the application
//======================================
for (NSString* family in [UIFont familyNames]) {
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family]) {
NSLog(@" %@", name);
}
}
//======================================
@Kirow
Kirow / UIVIew+Cell.m
Created May 26, 2014 16:35
Return Cell superview
@implementation UIView (CellSuperview)
- (UITableViewCell *)cellSuperview {
UIView *tableCell = self;
do {
tableCell = tableCell.superview;
} while (tableCell && ![tableCell isKindOfClass:[UITableViewCell class]]);
return (UITableViewCell *) tableCell;
}
@end
/** String: Identifier **/
#define DEVICE_IDENTIFIER ( ( IS_IPAD ) ? DEVICE_IPAD : ( IS_IPHONE ) ? DEVICE_IPHONE , DEVICE_SIMULATOR )
/** String: iPhone **/
#define DEVICE_IPHONE @"iPhone"
/** String: iPad **/
#define DEVICE_IPAD @"iPad"
/** String: Device Model **/
@Kirow
Kirow / Image.m
Created June 9, 2014 08:33
Get image size by URL w/o loading it to memory
// This method requires ImageIO.framework
#import <ImageIO/ImageIO.h>
- (CGSize)sizeOfImageAtURL:(NSURL *)imageURL
{
// With CGImageSource we avoid loading the whole image into memory
CGSize imageSize = CGSizeZero;
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageURL, NULL);
if (source) {
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCGImageSourceShouldCache];
@Kirow
Kirow / StringEnum.h
Created July 8, 2014 08:39
String Enumeration
//================.h File======================
typedef enum {
EnumType_1,
EnumType_2,
EnumTypeCount // enum count
} EnumType;
//enum to string
#import "FileChangeObserver.h"
#undef Assert
#define Assert(COND) { if (!(COND)) { raise( SIGINT ) ; } }
@interface FileChangeObserver ()
@property ( nonatomic, readonly ) int kqueue ;
@property ( nonatomic ) enum FileChangeNotificationType typeMask ;
@end
//
// FDRCollectionViewCell.h
//
//
// Created by Brent Royal-Gordon on 7/10/13.
//
//
#import <UIKit/UIKit.h>
@Kirow
Kirow / Console.sh
Created November 17, 2014 11:29
How to fix home and end keys on Mac OS X
$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ vi DefaultKeyBinding.dict
//
// UIImage+H568.m
//
// Created by Angel Garcia on 9/28/12.
// http://angelolloqui.com/blog/20-iPhone5-568h-image-loading
//
#import "UIImage+H568.h"
#import <objc/runtime.h>
@Kirow
Kirow / README.md
Last active August 29, 2015 14:16 — forked from nicerobot/README.md

To run this, you can try:

curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh