This file contains hidden or 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
// on VC | |
// remove spacing | |
if ([self.table respondsToSelector:@selector(setSeparatorInset:)]) { // Safety check for below iOS 7 | |
[self.table setSeparatorInset:UIEdgeInsetsZero]; | |
} | |
// on custom cell subclass | |
- (UIEdgeInsets)layoutMargins | |
{ | |
return UIEdgeInsetsZero; |
This file contains hidden or 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
- (void)registerForPushNotifications | |
{ | |
UIApplication *sharedApplication = [UIApplication sharedApplication]; | |
if ([sharedApplication respondsToSelector:@selector(registerUserNotificationSettings:)]) { | |
UIUserNotificationType type = (UIUserNotificationTypeSound|UIUserNotificationTypeAlert|UIUserNotificationTypeBadge); | |
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:type | |
categories:nil]; | |
[sharedApplication registerUserNotificationSettings:notificationSettings]; |
This file contains hidden or 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
# to download | |
# curl -o Podfile https://gist.githubusercontent.com/mamaz/87909165fd6a5c496a6c/raw/dddf4aad97ecfda42ade1e0cc216fc8cad14e000/Podfile | |
platform :ios, '8.0' | |
inhibit_all_warnings! | |
source 'https://github.com/CocoaPods/Specs.git' | |
pod 'AFNetworking', '2.5.2' |
This file contains hidden or 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/sh | |
# | |
# Simple script for uploading binaries to Fabric (d/h Crashlytics) | |
# | |
# written by @taufik_obet | |
# modified for pushing to fabric by @hismamaz | |
# | |
# |
This file contains hidden or 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
// iOS 7+ | |
// on custom cell | |
- (void)awakeFromNib // or layoutSubviews | |
{ | |
// make table separator without any indent | |
if ([self respondsToSelector:@selector(setLayoutMargins:)]) { | |
self.layoutMargins = UIEdgeInsetsZero; | |
} |
This file contains hidden or 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
Notice for building Custom Keyboard App using Jenkins and xctools | |
# please use $(BUILT_PRODUCTS_DIR) as Installation Directory on Build Settings | |
# please specify $(SDKROOT)/ResourceRules.plist as Code Signing Resource Rules Path | |
# use 2 prov profile: containing app and custom keyboard extension |
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
/** | |
User refrence sign '&' to make it pass by refernce. | |
*/ | |
void initString(char* &dest) { | |
dest = new char[255]; | |
dest[0] = 'a'; |
This file contains hidden or 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
// draw circler image | |
-(void)drawClippedAvatar:(UIImage *)image inRect:(CGRect)rect andContext:(CGContextRef)context | |
{ | |
CGMutablePathRef path = CGPathCreateMutable(); | |
CGPathAddEllipseInRect(path, NULL, rect); | |
CGContextAddPath(context, path); | |
CGContextClip(context); | |
CGPathRelease(path); | |
[image drawInRect:rect]; | |
} |
This file contains hidden or 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
/* | |
Get UILabel's size for wordwrapping style | |
*/ | |
+(CGSize)getLabelSizeWordWrapWithString:(NSString*)string | |
font:(UIFont*)font | |
constrainedToSize:(CGSize)constrainedSize | |
{ | |
if (IOS_VERSION_LESS_THAN_7) { | |
This file contains hidden or 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
// Print filename and line with comments | |
// credits to Taufik Obet | |
#ifndef __OPTIMIZE__ | |
# define NSLog(...) printf("[%-30s:%4d]: %s\n", __FILE_NAME_ONLY__, __LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]) | |
#else | |
#define NSLog(...) do {} while (0) | |
#endif |