Skip to content

Instantly share code, notes, and snippets.

View rounak's full-sized avatar

Rounak rounak

View GitHub Profile
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
// 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) {
//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 23:59
Portion of the code that does the deceleration
//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;
}
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"];
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 January 18, 2013 07:19
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.
#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)