Skip to content

Instantly share code, notes, and snippets.

@ajonnet
ajonnet / NSDataFromHexString.m
Last active August 29, 2015 14:02
Generates NSData instance for given hex String. Hex string is looked up from 0th index to nth index, for hex literals and accordingly NSData instance is generated.
-(NSData *) NSDataFromHexString:(NSString *) hexstr
{
NSMutableData *data = [[NSMutableData alloc] init];
NSString *inputStr = [hexstr uppercaseString];
NSString *hexChars = @"0123456789ABCDEF";
Byte b1,b2;
b1 = 255;
b2 = 255;
@ajonnet
ajonnet / NSStringHexFormatFromNSData.m
Created June 22, 2014 09:10
Generates Hexadecimal String from given instance of NSData. ex. "0A:1B:CC"
-(NSString *) NSStringHexFormatFromData:(NSData *) data
{
Byte *bytes = (Byte *)data.bytes;
NSMutableString *str = [[NSMutableString alloc] init];
for (int i =0; i<data.length; i++) {
[str appendFormat:@"%02X",bytes[i]];
if (i!= (data.length -1)) {
[str appendString:@":"];
@ajonnet
ajonnet / HideNavBar
Created July 20, 2014 12:17
IOS 7.0 Hide Navigation Bar
//Hide the Navigation Bar
if (self.navigationController) {
self.navigationController.navigationBarHidden = YES;
}
@ajonnet
ajonnet / TrimWhiteSpaces
Created July 20, 2014 12:30
Trim WhiteSpaces from ends of String
//Trimming WhiteSpaces from String
NSString *str = @" String with whitespaces ";
str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@ajonnet
ajonnet / findProjectBaseDirectory
Last active March 4, 2016 06:57
Locate directory, where iPhone Simulator is storing data for an app
po NSHomeDirectory()
@ajonnet
ajonnet / asteriskCricle
Created March 4, 2016 06:52
Function to print circle of Asterisk in Objective C
-(void) asteriskCircleWidthRadius:(CGFloat)rad filled:(BOOL) fill border:(NSUInteger) borderW{
borderW -= 1;
CGFloat dia = (rad + borderW) * 2;
CGFloat centerX,centerY;
centerX = centerY = dia/2.0; //-1 for
NSMutableString *op = [NSMutableString string];
NSMutableString *opCircle = [NSMutableString string];
[op appendString:@"\n"];
@ajonnet
ajonnet / info.txt
Last active May 9, 2016 05:46
ViewController Callbacks
-->ViewController Callbacks
loadView Called
viewDidLoad called
ViewWillAppear called
WillLayoutSubviews called
DidLayoutSubviews called
viewDidAppear called
-->Location for XCode Plugins
~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/
@ajonnet
ajonnet / NavCtlrBackTitleHider.h
Created April 9, 2016 11:53
NavigationController BackButton Title hider
#import <Foundation/Foundation.h>
@interface NavCtlrBackTitleHider : NSObject <UINavigationControllerDelegate>
@end
gsutil rsync -rd -x \.git . gs://your-bucket
@ajonnet
ajonnet / raspiCam.pc
Created October 27, 2017 12:59
raspiCam.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
mmalLibDir=/opt/vc/lib
Name: raspiCam
Description: RaspiCam library
Version: 0.1.6
Libs: -L${mmalLibDir} -L${exec_prefix}/lib -lraspicam -lraspicam_cv -lmmal -lmmal_core -lmmal_util