Skip to content

Instantly share code, notes, and snippets.

Christopher Bowns cbowns

Block or report user

Report or block cbowns

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rafmagana / unwatch-repos.js
Last active Apr 30, 2018
Unwatch multiple repositories at once in GiHub
View unwatch-repos.js
Go to
Paste this function in the console
e.g. unwatchRepos("rails|node|go")
That unwatches repos containing rails, node or go in the repo link.
var unwatchRepos = (pattern) => {
var list = document.getElementsByClassName('repo-list')[0]
var rows = list.getElementsByClassName('js-subscription-row')
steipete / UITableViewMore.m
Last active Jan 29, 2018
Using the "More" button. Of course the simple way that Apple uses in Mail/iOS is not public. rdar://16600859
View UITableViewMore.m
- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"More";
- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me...");
// Hide the More/Delete menu.
[self setEditing:NO animated:YES];
steipete / UIView+PSPDFKitAdditions.h
Last active Jun 30, 2016
Simple solution that allows to block the parent layoutSubview-triggering, see In short, changing a frame of a subview outside of layoutSubviews will trigger the parent's layoutSubviews. Sometimes this is not what we want, especially when you consider performance. In my case ( this was…
View UIView+PSPDFKitAdditions.h
@interface UIView (PSPDFKitAdditions)
// Allows to change frame/bounds without triggering `layoutSubviews` on the parent.
// Not needed for changes that are performed within `layoutSubviews`.
- (void)pspdf_performWithoutTriggeringSetNeedsLayout:(dispatch_block_t)block;
#import "UIView+PSPDFKitAdditions.h"
steipete / Macros.h
Last active Dec 24, 2018
Declare on your main init that all other init methods should call. It's a nice additional semantic warning. Works with Xcode 5.1 and above. Not tested with earlier variants, but should just be ignored. A reference to this macro shortly appeared in…
View Macros.h
#if __has_attribute(objc_designated_initializer)
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer))
steipete / gist:9021032
Created Feb 15, 2014
Run Script that converts TODO or FIXME or ??? into a warning. Super useful.
View gist:9021032
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
View UIKitPatches.m
static void PSPDFFixCenteringInPrinterBrowserViewController(void) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// Patch the `UIPrinterSearchingView` class so we get a sane label placement in iOS 7.
Class printerSearchingViewClass = NSClassFromString([NSString stringWithFormat:@"UI%@Searching%@", @"Printer", @"View"]);
if (printerSearchingViewClass) {
SEL customLayoutSubviewsSEL = NSSelectorFromString(@"pspdf_layoutSubviews");
id customLayoutSubviews = ^(UIView *_self) {
((void( *)(id, SEL))objc_msgSend)(_self, customLayoutSubviewsSEL); // call original.
@try {
View gist:8213806
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
lennypham / gist:7026020
Created Oct 17, 2013
Macro for converting hex color values into a UIColor object.
View gist:7026020
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
View gist:6891174
#pragma mark -
#pragma mark CGFloat
#pragma mark Trigonometric Functions
#define CGFloatCos(a) (CGFLOAT_IS_DOUBLE ? cos(a) : cosf(a))
#define CGFloatSin(a) (CGFLOAT_IS_DOUBLE ? sin(a) : sinf(a))
#define CGFloatTan(a) (CGFLOAT_IS_DOUBLE ? tan(a) : tanf(a))
#define CGFloatACos(a) (CGFLOAT_IS_DOUBLE ? acos(a) : acosf(a))
#define CGFloatASin(a) (CGFLOAT_IS_DOUBLE ? asin(a) : asinf(a))
#define CGFloatATan(a) (CGFLOAT_IS_DOUBLE ? atan(a) : atanf(a))
View WeakDetector.m
#pragma mark - Warn if we KVO a weak property
// Doesn't support key paths.
static BOOL PSPDFIsWeakProperty(id object, NSString *keyPath) {
objc_property_t property = class_getProperty([object class], keyPath.UTF8String);
if (property) {
const char *attributes = property_getAttributes(property);
return attributes && strstr(attributes, ",W");
You can’t perform that action at this time.