Skip to content

Instantly share code, notes, and snippets.

Avatar

Rounak rounak

View GitHub Profile
View ATS Disable
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
View gist:9785e82708d44ea550dd
// by d whyte
int[][] result;
float t;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
View CustomScrollView.m
//get velocity from pan gesture
CGPoint velocity = [panGestureRecognizer velocityInView:self];
if (self.bounds.size.width >= self.contentSize.width) {
//make movement zero along x if no horizontal scrolling
velocity.x = 0;
}
if (self.bounds.size.height >= self.contentSize.height) {
//make movement zero along y if no vertical scrolling
velocity.y = 0;
}
@rounak
rounak / CustomScrollView.m
Created May 2, 2014
Portion of the code that does the deceleration
View CustomScrollView.m
//get velocity from pan gesture
CGPoint velocity = [panGestureRecognizer velocityInView:self];
if (self.bounds.size.width >= self.contentSize.width) {
//make movement zero along x if no horizontal scrolling
velocity.x = 0;
}
if (self.bounds.size.height >= self.contentSize.height) {
//make movement zero along y if no vertical scrolling
velocity.y = 0;
}
View popanimation.m
POPSpringAnimation *springAnimation = [POPSpringAnimation animation];
springAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewCenter];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(self.view.bounds.size.width/2, self.view.bounds.size.height/2)];
springAnimation.velocity = [NSValue valueWithCGPoint:CGPointMake(100, 10)];
[imageView pop_addAnimation:springAnimation forKey:@"center"];
View Custom loader
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
imageView.animationImages = [self animationImages]; //method to return an array of UIImage objects
imageView.animationDuration = 0.5; //could be whatever you want
[imageView startAnimating]; //for starting animation
[imageView stopAnimating]; //for ending animation
@rounak
rounak / twitter_clients.rb
Created Jan 18, 2013
Script writes to STDOUT the Twitter clients you've used along with the number of tweets. Save the output as something.csv and open in Excel/Numbers to do interesting things like making charts etc.
View twitter_clients.rb
#redirect stdout to something.csv and open it in Numbers/Excel to do whatever you want
require 'csv'
#total_tweets = 0
client_hash = {}
dir_name = "~/path/to/tweetsfolder/" + "data/csv/" #insert path to tweets folder
file_paths_array = Dir.entries(dir_name)
file_paths_array.delete_at(0)
file_paths_array.delete_at(0)
file_paths_array.each do |file_path|
arr_of_arrs = CSV.read(dir_name+file_path)
You can’t perform that action at this time.