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
double readabilityMean = 0.0; | |
if (readabilityText != null){ | |
BasicDBObject readabilityScoresObj = new BasicDBObject(); | |
readabilityScoresObj.put("text", readabilityText); | |
BagOfReadabilityObjects readabilityStats = new Readability(readabilityText).getMetrics(); | |
double normalizedFlesch = (100 - Math.abs(readabilityStats.getFleschReading() - 50))/100; | |
double normalizedFleschKincaid = (16 - Math.abs(readabilityStats.getFleschReading() - 13))/16; | |
double normalizedARI = (16 - Math.abs(readabilityStats.getARI() - 13))/16; | |
double normalizedLiau = (16 - Math.abs(readabilityStats.getColemanLiau() - 13))/16; |
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)pushInViewsWithBounce { | |
self.collectionView.hidden = NO; | |
for (NSInteger i=0; i<100; i++){ | |
UIView * viewToAnimate = [self.view viewWithTag:i]; | |
if ([viewToAnimate isKindOfClass:[AFCollectionViewCell class]]){ | |
viewToAnimate.hidden = YES; | |
CALayer * layerToMove = viewToAnimate.layer; |
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
// | |
// RVCollectionViewLayout.m | |
// RouletteViewDemo | |
// | |
// Created by Kenny Tang on 3/16/13. | |
// Copyright (c) 2013 Kenny Tang. All rights reserved. | |
// | |
#import "RVCollectionViewLayout.h" | |
#import "RVCollectionViewCell.h" |
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
/* | |
pseudo code: | |
*/ | |
var singleRotationValue = 360/this.images; | |
for (var i=0; i<this.images; i++){ | |
var cardElement = document.createElement(‘div’); | |
var rotation = singleRotationValue*i + 180; | |
var applyTransform = ‘ rotateZ(‘ + rotation + ‘deg) translateY(‘ + wheelRadius + ‘) translateX(‘ + wheelRadius + ‘)’; | |
cardElement.style.webkitTransform = applyTransform; |
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 * facebookOptions = @{ACFacebookAppIdKey:kPSHFacebookAppID, | |
ACFacebookPermissionsKey: @[@"email", @"publish_stream", @"read_stream", @"user_photos"], | |
ACFacebookAudienceKey:ACFacebookAudienceFriends}; | |
ACAccountType * facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]; | |
[self.accountStore requestAccessToAccountsWithType:facebookAccountType options:facebookOptions | |
completion: ^(BOOL granted, NSError *error) { | |
NSLog(@"granted: %i", granted); | |
if (granted) { | |
NSArray *accounts = [self.accountStore accountsWithAccountType:facebookAccountType]; |
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) likeFeed:(NSString*)graphID { | |
InitAccountSuccessBlock successBlock = ^{ | |
NSString * likeURLString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/likes", graphID]; | |
NSURL * feedURL = [NSURL URLWithString:likeURLString]; | |
SLRequest * request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:feedURL parameters:nil]; | |
NSLog(@"request.URL: %@", request.URL); | |
request.account = self.facebookAccount; | |
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { |
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
// save before refreshing data | |
[[NSManagedObjectContext MR_defaultContext] saveWithOptions:MRSaveSynchronously completion:^(BOOL success, NSError *error) { | |
NSArray * feedItemsArray = [FeedItem findAllSortedBy:@"createdTime" ascending:NO]; | |
fetchFeedSuccess(feedItemsArray, 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
platform :ios, '6.1' | |
pod 'MagicalRecord', '~>2.1.0' | |
pod 'AFNetworking', '~>1.2.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
- (void)animateBackground { | |
NSInteger randInt = arc4random()%3; | |
NSInteger translationX = 0; | |
NSInteger translationY = 0; | |
NSInteger scaleX = 0; | |
NSInteger scaleY = 0; | |
switch (randInt) { |
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)stopAnimateBackground { | |
self.backgroundImageView.transform = CGAffineTransformIdentity; | |
[UIView setAnimationsEnabled:YES]; | |
} |
OlderNewer