This file contains 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
public final class Singleton3{ | |
private static class Handler{ | |
private static final Singleton3 INSTANCE = new Singleton3(); | |
} | |
private Singleton3(){ | |
if (null != Handler.INSTANCE){ | |
throw new IllegalArgumentException("Already instantiated."); | |
} | |
} |
This file contains 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
// UIApplication.h | |
UIApplicationDidEnterBackgroundNotification __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); | |
UIApplicationWillEnterForegroundNotification __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); | |
UIApplicationDidFinishLaunchingNotification; | |
UIApplicationDidBecomeActiveNotification; | |
UIApplicationWillResignActiveNotification; | |
UIApplicationDidReceiveMemoryWarningNotification; | |
UIApplicationWillTerminateNotification; | |
UIApplicationSignificantTimeChangeNotification; | |
UIApplicationWillChangeStatusBarOrientationNotification; // userInfo contains NSNumber with new orientation |
This file contains 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> | |
int main (int argc, char * const argv[]) { | |
int i = 6; | |
std::cout << i++ << std::endl; | |
int j = i++; | |
std::cout << j << std::endl; | |
int p = 7; | |
std::cout << ++p << std::endl; |
This file contains 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> | |
int main (int argc, char * const argv[]) { | |
int a[] = {3,2,1,0}; | |
int *pa = a; | |
std::cout << pa++ << std::endl; | |
return 0; | |
} |
This file contains 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
public class Stack { | |
private Object[] elements; | |
private int size = 0; | |
public Stack(int initialCapacity) { | |
this.elements = new Object[initialCapacity]; | |
} | |
public void push(Object e) { | |
ensureCapacity(); |
This file contains 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> | |
int main (int argc, char * const argv[]) { | |
int i = 5; | |
int *p = &i; | |
++*p; | |
std::cout << i << std::endl; | |
return 0; | |
} |
This file contains 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> | |
int main (int argc, char * const argv[]) { | |
int i = 1; | |
int j = i << 4; | |
std::cout << j << std::endl; | |
return 0; | |
} |
This file contains 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
#define myIndexPath [NSIndexPath indexPathForRow:2 inSection:1] | |
NSAssert(myIndexPath == [NSIndexPath indexPathForRow:2 inSection:1], @"they should be the same object"); | |
// omitted code from UITableView -cellForRowAtIndexPath: | |
if (myIndexPath == systemIndexPath){ | |
// my cell, show my contents | |
} | |
This file contains 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
wc -l `find . -type f \( -name "*.h" -or -name "*.m" \)` |
This file contains 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
find . -type f \( -name '*.xib' -or -name "*.h" -or -name "*.m" \) -exec awk '{print NR}' {} +|tail -1 |