Skip to content

Instantly share code, notes, and snippets.

View jonfriskics's full-sized avatar

Jon Friskics jonfriskics

View GitHub Profile
@jonfriskics
jonfriskics / gist:4494761
Created January 9, 2013 16:55
dock spacer
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
@jonfriskics
jonfriskics / gist:5714789
Created June 5, 2013 15:32
Fix Github repositories sidebar CSS with Stylish
/* ***************
** The sidebar as of 6/5/2013 unnecessarily truncates repo names in the repositories sidebar and makes it hard to tell repos
** with similar names apart
** Add this as a user style for http://github.com and https://github.com
***************
*/
.css-truncate-target {
overflow: visible;
white-space: normal;
@jonfriskics
jonfriskics / gist:5905923
Created July 2, 2013 00:37
Remove the Accelerate Framework from the iOS 6.1 - 7.0 API diffs because they are long and I don't care about them. No hard feelings, right Accelerate?
// Stylish script for the URL: https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS70APIDiffs/
div.diffReport h2:nth-of-type(3):before {
content: " -------- "
}
div.diffReport h2:nth-of-type(3):after {
content: " ---- REMOVED FOR EASY READING --------"
}
div.diffReport div.headerFile:nth-of-type(11) {
display: none;
@jonfriskics
jonfriskics / ViewController.h
Created July 2, 2013 05:03
AFNetworking GET and POST example
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) UILabel *getResponseLabel;
@property (strong, nonatomic) UILabel *postResponseLabel;
@end
@jonfriskics
jonfriskics / AppDelegate.h
Last active December 19, 2015 07:59
Using AFNetworking to query an API endpoint in the AppDelegate before any view controllers appear
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
@jonfriskics
jonfriskics / gist:6896230
Created October 9, 2013 04:29
UITextView and the keyboard
[[NSNotificationCenter defaultCenter] addObserverForName:@"UIKeyboardDidShowNotification" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
CGRect cursorRect = [self.textView caretRectForPosition:self.textView.selectedTextRange.start];
if(CGRectGetMaxY(cursorRect) > CGRectGetHeight(self.view.frame) - self.topLayoutGuide.length - 216) {
[UIView animateWithDuration:1.0f animations:^{
self.textView.contentOffset = CGPointMake(0, 216);
} completion:^(BOOL finished) {
}];
}
}];
@jonfriskics
jonfriskics / AppDelegate.m
Last active December 25, 2015 17:39
UIPageViewController example - demo of the pageViewController not interfering with touches on the child VCs.
#import "AppDelegate.h"
#import "ContainerVC.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[ContainerVC alloc] init];
@jonfriskics
jonfriskics / gist:9360674
Created March 5, 2014 03:34
UIImagePickerController tints
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
// for light navigation item text, or UIBarStyleDefault for dark navigation item text
imagePickerController.navigationBar.barStyle = UIBarStyleBlack;
// the actual color will be affected by the translucency setting
imagePickerController.navigationBar.barTintColor = [UIColor blueColor];
// default is YES, but you could change to NO
imagePickerController.navigationBar.translucent = YES;
@jonfriskics
jonfriskics / MapViewController.h
Last active September 6, 2018 12:21
Custom info window that can be interacted with using the Google Maps SDK for iOS
//
// MapViewController.h
// MapsCustomInfoWindow
//
// Created by Jon Friskics on 4/22/14.
// Copyright (c) 2014 Jon Friskics. All rights reserved.
//
#import <UIKit/UIKit.h>
@jonfriskics
jonfriskics / gist:11373716
Last active August 29, 2015 14:00
Making NSArray.count not throw an implicit signedness error when calling the tableView:numberOfRowsInSection: method
#import "TableViewController.h"
@interface NSArray (CountForTableView)
- (NSInteger)countForTableView;
@end
@implementation NSArray (CountForTableView)