Skip to content

Instantly share code, notes, and snippets.

@Pratik948
Pratik948 / README.md
Created April 19, 2020 19:00 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@Pratik948
Pratik948 / EndlessRecyclerOnScrollListener.java
Created May 1, 2018 16:56 — forked from pratikbutani/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener for pagination
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
private int visibleThreshold = 5;
// The current offset index of data you have loaded
private int currentPage = 0;
// The total number of items in the dataset after the last load
private int previousTotalItemCount = 0;
@Pratik948
Pratik948 / uiappearance-selector.md
Created December 4, 2017 13:16 — forked from mattt/uiappearance-selector.md
A list of methods and properties conforming to `UIAppearance` as of iOS 10.3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

@Pratik948
Pratik948 / UINavigationController+Fade.h
Created September 16, 2017 05:49 — forked from ksm/UINavigationController+Fade.h
UINavigationController custom pop/push transition animation
/*
Copied and pasted from David Hamrick's blog:
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html
*/
@interface UINavigationController (Fade)
- (void)pushFadeViewController:(UIViewController *)viewController;
- (void)fadePopViewController;
@Pratik948
Pratik948 / in AppDelegate.h
Created May 4, 2017 14:19 — forked from mbrung/in AppDelegate.h
Initializing the Core Data stack in AppDelegate
@private
NSManagedObjectContext *managedObjectContext_;
NSManagedObjectModel *managedObjectModel_;
NSPersistentStoreCoordinator *persistentStoreCoordinator_;
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@Pratik948
Pratik948 / MyTabBar.m
Created March 29, 2017 10:02 — forked from benvium/MyTabBar.m
UITabBarController slide animation. Slide left and right when tabs are selected. Based on code from StackOverflow (linked in code)
- (BOOL) tabBarController:(UITabBarController *)tabBarController
shouldSelectViewController:(UIViewController *)viewController {
// http://stackoverflow.com/questions/5161730/iphone-how-to-switch-tabs-with-an-animation
NSUInteger controllerIndex = [self.viewControllers indexOfObject:viewController];
if (controllerIndex == tabBarController.selectedIndex) {
return NO;
}
@Pratik948
Pratik948 / BouncyButtonViewController.h
Created March 23, 2017 13:46 — forked from mrtj/BouncyButtonViewController.h
iOS view controller demonstrating how to create a bouncy rubber button with the new UIView method animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion: of iOS 7
#import <UIKit/UIKit.h>
@interface BouncyButtonViewController : UIViewController
@end
@Pratik948
Pratik948 / gist:4b0236d260e48991bd60a312788411d2
Created January 12, 2017 11:54 — forked from w-i-n-s/gist:2ac5a02237cb32ab93901741e581d24b
Instagram-like heartbeat animation using CABasicAnimation & CAAnimationGroup
NSMutableArray *animations = [NSMutableArray array];
// Step 1
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.toValue = @(1.3);
animation.duration = 0.3;
animation.fillMode = kCAFillModeForwards;
[animations addObject:animation];
}
{
@Pratik948
Pratik948 / Arrow.swift
Created October 21, 2016 15:16 — forked from mayoff/Arrow.swift
UIBezierPath category to create an arrow (now with a Swift version!)
// Swift 2.2 syntax / API
import UIKit
extension UIBezierPath {
class func arrow(from start: CGPoint, to end: CGPoint, tailWidth: CGFloat, headWidth: CGFloat, headLength: CGFloat) -> Self {
let length = hypot(end.x - start.x, end.y - start.y)
let tailLength = length - headLength