Skip to content

Instantly share code, notes, and snippets.

View jonfriskics's full-sized avatar

Jon Friskics jonfriskics

View GitHub Profile
@jonfriskics
jonfriskics / .gitattributes
Created September 25, 2019 15:08
.gitattributes file to add to Project repos
# From https://help.github.com/en/articles/configuring-git-to-handle-line-endings
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
@jonfriskics
jonfriskics / example-mocha-test.js
Last active September 9, 2019 18:54
Example Mocha.js Test
describe("QuizQuestion.js", () => {
it("should have a method named handleClick with the correct parameter @quiz-question-should-have-handle-click", () => {
assert("CONDITION CHECKING IF HANDLECLICK EXISTS", "`QuizQuestion.js` does not contain a method named `handleClick`")
assert("CONDITION CHECKING HANDLECLICK PARAMETER", "`QuizQuestion.js does not have the method named `handleClick` with a parameter named `buttonText`")
})
})
@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 / 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.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: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.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: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 / 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: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;