Skip to content

Instantly share code, notes, and snippets.

@pratikbutani
pratikbutani / EndlessRecyclerOnScrollListener.java
Last active December 15, 2023 13:05
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;
@zeroseis
zeroseis / disable-auto-android-file-transfer.md
Created September 14, 2015 17:28
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.

Generated within the iPhone Simulator (iOS Version 8.4 (12H141))

XS S M L XL XXL XXXL Accessibility M AccessibilityL AccessibilityXL AccessibilityXXL AccessibilityXXXL
UIFontTextStyleHeadline 14.0 15.0 16.0 17.0 19.0 21.0 23.0 23.0 23.0 23.0 23.0 23.0
UIFontTextStyleSubheadline 12.0 13.0 14.0 15.0 17.0 19.0 21.0 21.0 21.0 21.0 21.0 21.0
UIFontTextStyleBody 14.0 15.0 16.0 17.0 19.0 21.0 23.0 28.0 33.0 40.0 47.0 53.0
UIFontTextStyleFootnote 12.0 12.0 12.0 13.0 15.0 17.0 19.0 19.0 19.0 19.0 19.0 19.0
UIFontTextStyleCaption1 11.0 11.0 11.0 12.0 14.0 16.0 18.0 18.0 18.0 18.0 18.0 18.0
UIFontTextStyleCaption2 11.0 11.0 11.0 11.0 13.0 15.0 17.0 17.0 17.0 17.0 17.0 17.0
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 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 UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}