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 STATIC_CONST(name) static NSString * const name = @#name; | |
STATIC_CONST(LearningNavRestorationIdentifier) | |
STATIC_CONST(ProfileNavRestorationIdentifier) | |
STATIC_CONST(ReservationsNavRestorationIdentifier) | |
#undef STATIC_CONST | |
// Becomes: |
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
import winreg | |
import itertools | |
import binascii | |
import array | |
def hexlify(_bytes, reverse=True): | |
a = array.array('b', _bytes) | |
if swap: | |
a.reverse() | |
return binascii.hexlify(a.tobytes()).decode('utf-8') |
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
class Obj {} | |
class Obj2: Obj {} | |
let item1 = Obj(), item2 = Obj2() | |
if item1.dynamicType === item2.dynamicType { | |
print("Same subclass") | |
} else { | |
print("Different subclass") | |
} |
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
+ (NSDateFormatter *)dateFormatter { | |
return [[ISO8601DateFormatter alloc] init]; | |
} | |
+ (NSValueTransformer *)jsonDateValueTransformer { | |
return [MTLValueTransformer reversibleTransformerWithForwardBlock:^(NSString *str) { | |
return [self.dateFormatter dateFromString:str]; | |
} reverseBlock:^(NSDate *date) { | |
return [self.dateFormatter stringFromDate:date]; | |
}]; |
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
- (NSDictionary *)dictionaryOfPeople:(NSArray *)people { | |
return [people dictionaryViaEnumeration:^(Person *person, id *key, id *value) { | |
*key = person.identifier; | |
*value = person.name; | |
}]; | |
} | |
//////////////////// | |
typedef void (^TransformBlock)(id obj, id *key, id *value); |
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
alex@alex-silvercar:~/dev/mobile/driverapp/driverapp $ genstrings --help | |
alex@alex-silvercar:~/dev/mobile/driverapp/driverapp $ genstrings -h | |
alex@alex-silvercar:~/dev/mobile/driverapp/driverapp $ genstrings -help | |
alex@alex-silvercar:~/dev/mobile/driverapp/driverapp $ genstrings | |
Usage: genstrings [OPTION] file1.[mc] ... filen.[mc] | |
Options | |
-j sets the input language to Java. | |
-a append output to the old strings files. | |
-s substring substitute 'substring' for NSLocalizedString. |
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
collisionMatrix = new boolean[160][90]; | |
Pixmap backgroundMap = new Pixmap(Gdx.files.internal("data/warehouse-map.png")); | |
for (int y = 0; y < 90; y++) { | |
for (int x = 0; x < 160; x++) { | |
// Get the pixel, shifting off the alpha value | |
int pixel = backgroundMap.getPixel(x, y) >>> 8; | |
if (pixel == 0x000000) { | |
// true means impassible, also invert y to match our coordinate system | |
collisionMatrix[x][90 - y] = true; | |
} |
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
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar (160 KB at 125.9 KB/sec) | |
[INFO] Compiling 11 source files to /home/alex/apk2gold/jd-cli/target/classes | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] BUILD FAILURE | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Total time: 27.568s | |
[INFO] Finished at: Fri Jan 25 15:58:50 CST 2013 | |
[INFO] Final Memory: 10M/115M | |
[INFO] ------------------------------------------------------------------------ | |
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project jd-core-java: Compilation failure: Compilation failure: |
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 Cursor { | |
public static float DEFAULT_VELOCITY = 500f; | |
private final Vector2 position; | |
public final Vector2 velocity; | |
public Cursor() { | |
position = new Vector2(0, 0); | |
velocity = new Vector2(0, 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 func keyboardInfoFromUserInfo(userInfo: [NSObject: AnyObject]) -> (beginFrame: CGRect, endFrame: CGRect, animationCurve: UIViewAnimationOptions, animationDuration: Double)? { | |
if let beginFrameValue = userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue, | |
let endFrameValue = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue, | |
let animationCurve = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber, | |
let animationDuration = userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber { | |
return ( | |
beginFrame: beginFrameValue.CGRectValue(), | |
endFrame: endFrameValue.CGRectValue(), | |
animationCurve: UIViewAnimationOptions(rawValue: animationCurve.unsignedIntegerValue << 16), | |
animationDuration: animationDuration.doubleValue) |