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
- (UIInterfaceOrientation)orientationByTransforming:(CGAffineTransform)transform fromOrientation:(UIInterfaceOrientation)c | |
{ | |
CGFloat angle = atan2f(transform.b, transform.a); | |
NSInteger multiplier = (NSInteger)roundf(angle / M_PI_2); | |
UIInterfaceOrientation orientation = self.interfaceOrientation; | |
if (multiplier < 0) { | |
// clockwise rotation | |
while (multiplier++ < 0) { | |
switch (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
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
let segmentedControl = UISegmentedControl(items: ["Less Filling", "Tastes Great"]) | |
segmentedControl.addTarget(self, action: "segmentChanged:", forControlEvents: UIControlEvents.ValueChanged) | |
segmentedControl.selectedSegmentIndex = 0 | |
self.navigationItem.titleView = segmentedControl | |
} | |
func segmentChanged(sender: UISegmentedControl) { |
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
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:" | |
git ls-files '*.h' '*.m' '*.swift' -z | \ | |
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \ | |
perl -p -e "s/($KEYWORDS)/ warning: \$1/" |
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
+ (instancetype)newInstance { | |
id newInstance = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject]; | |
return [newInstance isKindOfClass:[self class]] ? newInstance : nil; | |
} |
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
#pragma mark - NSFetchedResultsControllerDelegate methods | |
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { | |
[self.tableView beginUpdates]; | |
} | |
- (void)controller:(NSFetchedResultsController *)controller | |
didChangeObject:(id)anObject | |
atIndexPath:(NSIndexPath *)indexPath | |
forChangeType:(NSFetchedResultsChangeType)type |
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
robocopy "C:\Users\Public\Public Games" "D:\Backup\Games" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\Desktop" "D:\Backup\Jamin\Desktop" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\Downloads" "D:\Backup\Jamin\Downloads" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\Documents" "D:\Backup\Jamin\Documents" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\Music" "D:\Backup\Jamin\Music" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\Pictures" "D:\Backup\Jamin\Pictures" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\Videos" "D:\Backup\Jamin\Videos" /S /Z /PURGE /R:5 /W:5 /V | |
robocopy "C:\Users\Jamin\AppData" "D:\Backup\Jamin\AppData" /S /Z /PURGE /R:5 /W:5 /V | |
pause |
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
[ | |
[ | |
"HTTP_ACCEPT", | |
"*/*" | |
], | |
[ | |
"HTTP_HOST", | |
"httpecho.heroku.com" | |
], | |
[ |
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
def on_receive(self, response_chunk): | |
self.response_object += str(response_chunk).strip() | |
if response_chunk.endswith("\r\n") and self.response_object.strip(): | |
try: | |
adn_object = self.response_object.strip() | |
self.publish_message(adn_object) | |
except Exception as e: | |
text = "on_receive error {}".format(e) | |
print text | |
log.error(text) |
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
{ | |
"match_policy": "include_any", | |
"clauses": [ | |
{ | |
"operator": "one_of", | |
"field": "/data/entities/mentions/*/id", | |
"object_type": "post", | |
"value": [ | |
"5952", | |
"26215", |
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
- (void)configureScoreDescriptionText { | |
if(kloutUser.kscoreDescription) { | |
CTTextAlignment kAlignment = kCTLeftTextAlignment; | |
CGFloat lineSpacing = 1.0; | |
CTParagraphStyleSetting paragraphSettings[] = { | |
{ kCTParagraphStyleSpecifierAlignment, sizeof(kAlignment), &kAlignment}, | |
{ kCTParagraphStyleSpecifierLineSpacing, sizeof(lineSpacing), &lineSpacing} | |
}; | |
NSMutableDictionary *stringAttributes = [NSMutableDictionary dictionary]; | |
CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(paragraphSettings, sizeof(paragraphSettings)); |