Skip to content

Instantly share code, notes, and snippets.

@ddesai
ddesai / adb-logcat
Created March 21, 2015 23:42
howto get android device logs - adb
PRE-CONDITION:
* You already have "adb" tool available from the command line.
* Details on the various usage of adb is here: http://developer.android.com/tools/help/adb.html#Enabling
1) Connect the android device to the laptop using USB
2) Use the command below on your laptop to redirect the log to the file - say mylog.txt
adb logcat >mylog.txt
@ddesai
ddesai / android-screen-monitor
Last active August 29, 2015 14:09
android screen monitor
* Download the ZIP from here: https://code.google.com/p/android-screen-monitor/
* unzip it and extract asm.jar
* move it to your favorite location -- say ~ddesai/
* connect the phone using USB
* run it "java -jar ~ddesai/asm.jar
and you will see the Android screen on your laptop (Mac!)
HowTos:
* You can select device by CTRL + D (or context menu)
@ddesai
ddesai / objC-categories
Created September 17, 2014 23:10
objectiveC - Categories
http://rypress.com/tutorials/objective-c/categories.html
@ddesai
ddesai / iOS-notifications-observers
Created September 17, 2014 21:19
iOS - Notifications & Observers
Multiple observers can register for the Notifications.. Similar to Broadcast/Receivers on Android
@ddesai
ddesai / objC-protocols-delegates
Created September 17, 2014 18:15
objectiveC - Protocols & Delegates
One-to-One relation (unlike Notifications - observers)
@ddesai
ddesai / objC-grand-central-dispatch
Created September 16, 2014 22:05
objectiveC - Grand Central Dispatch
dispatch_queue_t queue = dispatch_queue_create("com.paypal.dadesai.gcd", DISPATCH_QUEUE_SERIAL);
__block int x = 5;
dispatch_async(queue, ^{
for(int i=0; i<10; i++) {
//x = x+i;
NSLog(@"Block 1: %d", x);
}
});
@ddesai
ddesai / objC-blocks
Created September 16, 2014 21:12
objectiveC - Blocks
Anonymous code block - which can be assigned to the variable. This code block can be passed as argument to another functions.
https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/Blocks/Articles/bxGettingStarted.html#//apple_ref/doc/uid/TP40007502-CH7-SW1
@ddesai
ddesai / objC-modifiers
Created September 15, 2014 20:51
objectiveC variable modifiers
atomic //default
nonatomic
strong //default for objects
weak
retain
assign //default for premitives
unsafe_unretained
copy
readonly
@ddesai
ddesai / iOS-basic-framework
Created September 15, 2014 18:11
iOS Basic Framework - Naming etc
1) UI - UIKit - developed in objectiveC - need for UI
Class names starts with "UI" - e.g. UILabel
2) Foundation - developed in objectiveC
Class names start with "NS" - e.g. NSString
3) CoreFoundation - developed in C
Class names (actually structures) start with "CF" - e.g. CFString
@ddesai
ddesai / objC-methods
Created September 15, 2014 17:24
objC: "-" and "+" methods
@interface MyClass : NSObject
{
int myInt;
NSNumber *myNumber;
}
- (void) doSomething;
+ (void) doSomethingElseWith:(NSNumber*) a;