This file contains hidden or 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
-(BOOL)isDarkImage:(UIImage*) inputImage { | |
BOOL isDark = FALSE; | |
CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(inputImage.CGImage)); | |
const UInt8 *pixels = CFDataGetBytePtr(imageData); | |
int darkPixels = 0; | |
int length = CFDataGetLength(imageData); |
This file contains hidden or 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
// Based on http://stackoverflow.com/a/12925659/2185 | |
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *bottomConstraint; | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Subscribe to the keyboard will show notification | |
[[NSNotificationCenter defaultCenter] addObserver:self |
This file contains hidden or 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
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
/** | |
* As long as your custom cell classes are laid out in Interface Builder and | |
* have Autolayout constraints to the top and bottom edges of the content view, | |
* the size of the cell can be computed based on how tall it needs to be. | |
* | |
* USE AT YOUR OWN RISK. This causes a noticable performance hit on a table of | |
* only about 15 cells. It might work OK on tables with only a few cells, but | |
* be sure to test it for your actual use case. I'm only sharing this on gist | |
* because I found it interesting. |
This file contains hidden or 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
javascript:if(document.referrer) window.open(document.referrer, '_blank'); else alert("No referrer found"); |
This file contains hidden or 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
// From BrendanAnnable: https://coderwall.com/p/akdgoq/expand-all-outdated-diff-comments-in-a-github-pull-request#comment_27799 | |
javascript:Array.from(document.getElementsByClassName('outdated-diff-comment-container')).forEach(l => l.classList.add('open')); |
This file contains hidden or 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
import UIKit | |
class Foo { | |
private let someID: String | |
init() { | |
self.someID = UUID().uuidString | |
} | |
OlderNewer