Skip to content

Instantly share code, notes, and snippets.

@HeshamMegid
HeshamMegid / AppDelegate.m
Created January 11, 2017 16:08 — forked from walkerc4/AppDelegate.m
iOS AppDelegate with multiple crash handlers, including custom one to show local notification that the app has crashed
@interface AppDelegate()
@property (nonatomic, assign) NSUncaughtExceptionHandler *crashHandler1;
@property (nonatomic, assign) NSUncaughtExceptionHandler *crashHandler2;
@end
@implementation AppDelegate
AppDelegate *cSelf;
func instabug(gestureRecognizer: UIGestureRecognizer) {
if gestureRecognizer.state = .recognized {
Instabug.invoke(with: .newBug)
}
}
echo "Committing the build number..."
cd "${PROJECT_DIR}";git add "Focus List/Focus List-Info.plist"
cd "${PROJECT_DIR}";git commit -m "Bumping build number."
cd "${PROJECT_DIR}";git push origin HEAD
echo "Build number committed."
echo "Tagging the Archive..."
versionnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
tagnumber="$versionnum-$buildnum"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-itunes-app" content="app-id=504979585, app-argument=http://zoboon.com/merchants/view/3">
<title>Twitter</title>
</head>
<body>
<p>This opens a discover item in the app</p>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-itunes-app" content="app-id=504979585, app-argument=http://zoboon.com/share/offer/2392">
<title>Twitter</title>
</head>
<body>
<p>This opens a discover item in the app</p>
</body>
@HeshamMegid
HeshamMegid / gist:6745678
Created September 28, 2013 19:36
Transliteration using CFStringTransform
NSMutableString *string = [@"جمهورية مصر العربيه" mutableCopy];
CFStringTransform((__bridge CFMutableStringRef)string, NULL, kCFStringTransformToLatin, NO);
NSLog(@"%@", string);
// Outputs jmhwryẗ mṣr ạlʿrbyh
@HeshamMegid
HeshamMegid / MKStoreKit.podspec
Last active December 20, 2015 07:49
iOS podspec for MKStoreKit-cop
Pod::Spec.new do |s|
s.name = 'MKStoreKit-cop'
s.version = '5.0'
s.license = { :type => 'MIT',
:text => 'MKStoreKit uses MIT Licensing And so all of my source code can
be used royalty-free into your app. Just make sure that you don’t
remove the copyright notice from the source code if you make your
app open source and in the about page.' }
s.summary = 'In-App Purchases StoreKit for iOS devices.'
s.homepage = 'https://github.com/Coppertino/MKStoreKit'
@HeshamMegid
HeshamMegid / HMHTTPClient.h
Last active December 16, 2015 02:19
An AFHTTPClient subclass that works around the NSURLConnection caching bug in iOS 6.
//
// HMHTTPClient.h
//
// Created by Hesham Abd-Elmegid on 4/10/13.
// Copyright (c) 2013 Startappz. All rights reserved.
//
#import "AFHTTPClient.h"
@interface HMHTTPClient : AFHTTPClient
@HeshamMegid
HeshamMegid / AddressBookManager.h
Last active February 1, 2023 11:28
Lookup a contact name/photo using phone number in ABAddressBook
#import <Foundation/Foundation.h>
#import "Contact.h"
@interface AddressBookManager : NSObject
+ (NSString *)nameForContactWithPhoneNumber:(NSString *)phoneNumber;
+ (UIImage *)photoForContactWithPhoneNumber:(NSString *)phoneNumber;
@end
#import <Foundation/Foundation.h>
@interface NSObject (NSDictionaryRepresentation)
/**
Returns an NSDictionary containing the properties of an object that are not nil.
*/
- (NSDictionary *)dictionaryRepresentation;
@end