This file contains hidden or 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
| -- | |
| -- Created by Danilo Priore. | |
| -- Copyright (c) 2012 Prioregroup.com. All rights reserved. | |
| -- | |
| -- Permission is hereby granted, free of charge, to any person obtaining a copy | |
| -- of this software and associated documentation files (the "Software"), to deal | |
| -- in the Software without restriction, including without limitation the rights | |
| -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| -- copies of the Software, and to permit persons to whom the Software is | |
| -- furnished to do so, subject to the following conditions: |
This file contains hidden or 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
| -- | |
| -- Created by Danilo Priore. | |
| -- Copyright (c) 2012 Prioregroup.com. All rights reserved. | |
| -- | |
| -- Permission is hereby granted, free of charge, to any person obtaining a copy | |
| -- of this software and associated documentation files (the "Software"), to deal | |
| -- in the Software without restriction, including without limitation the rights | |
| -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| -- copies of the Software, and to permit persons to whom the Software is | |
| -- furnished to do so, subject to the following conditions: |
This file contains hidden or 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
| ' | |
| ' Created by Danilo Priore. | |
| ' Copyright (c) 2012 Prioregroup.com. All rights reserved. | |
| ' | |
| ' | |
| ' Permission is hereby granted, free of charge, to any person obtaining a copy | |
| ' of this software and associated documentation files (the "Software"), to deal | |
| ' in the Software without restriction, including without limitation the rights | |
| ' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| ' copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or 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
| // | |
| // ReviewEngine.h | |
| // | |
| // Created by Danilo Priore on 23/11/11. | |
| // Copyright (c) 2011 Prioregroup.com. All rights reserved. | |
| // | |
| // ReviewEngine simplifies the calling to app internet page for requesting a | |
| // user review of the app on the app store. To use it simply drop the two | |
| // files into your code and then add one method call to get it working. |
This file contains hidden or 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
| NSString *input = @"\\u5404\\u500b\\u90fd"; | |
| CFStringTransform((__bridge CFMutableStringRef)input, NULL, CFSTR("Any-Hex/Java"), YES); | |
| NSLog(@"Readable string: %@", input); |
This file contains hidden or 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
| // UILabel text size fit macro | |
| // | |
| // use : | |
| // | |
| // UILabel *label = .... | |
| // TEXT_FIT(label, @"your text here"); | |
| // | |
| #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | |
| #define TEXT_FIT_IOS6(t,txt) (CGRect){t.frame.origin, t.frame.size.width, [txt sizeWithFont:t.font constrainedToSize:t.frame.size lineBreakMode:t.lineBreakMode].height} | |
| #define TEXT_FIT_IOS7(t,txt) (CGRect){t.frame.origin, t.frame.size.width, [txt boundingRectWithSize:t.frame.size options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:t.font} context:nil].size.height} |
This file contains hidden or 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
| # put script in ~/Library/Application Support/TextWrangler/Text Filters/Tidy XML.py | |
| #!/bin/sh | |
| XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 - |
This file contains hidden or 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
| # put script in ~/Library/Application Support/TextWrangler/Text Filters/Format JSON.py | |
| #!/usr/bin/python | |
| import fileinput | |
| import json | |
| if __name__ == "__main__": | |
| text = '' | |
| for line in fileinput.input(): | |
| text = text + ' ' + line.strip() | |
| jsonObj = json.loads(text) | |
| print json.dumps(jsonObj, sort_keys=True, indent=2) |
This file contains hidden or 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
| NSString *input = @"\\u5404\\u500b\\u90fd"; | |
| CFStringTransform((__bridge CFMutableStringRef)input, NULL, CFSTR("Any-Hex/Java"), YES); | |
| NSLog(@"Readable string: %@", input); |
This file contains hidden or 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
| @implementation NSDictionary (Values) | |
| - (id)valueForKeyPath:(NSString *)keyPath | |
| { | |
| __block id value = nil; | |
| if (keyPath != nil) { | |
| NSArray *keys = [keyPath componentsSeparatedByString:@"."]; | |
| if (keys && [keys count] > 0) { | |
| [keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { |