Skip to content

Instantly share code, notes, and snippets.

View UIKitTestUtils.swift
// Taken from: https://github.com/jeffh/TestingInSwift/blob/2d011f227f0ca1552680eba08f213792660ea32d/RandomAppTests/Support/UISupport.swift
// All of these functions here are inspired/ported from PivotalCoreKit
// https://github.com/pivotal/PivotalCoreKit
import UIKit
import Nimble
// emulates a tap on a bar button item. Does not support customViews
//func tap(barButtonItem: UIBarButtonItem) {
// SelectorProxy(target: barButtonItem.target).performAction(barButtonItem.action, withObject: barButtonItem)
//}
@fatuhoku
fatuhoku / parse_thumbnail
Created November 17, 2015 21:51 — forked from lukejohnjones/parse_thumbnail
Parse.com thumbnail creation retaining aspect ratio
View parse_thumbnail
var Image = require("parse-image");
Parse.Cloud.beforeSave("_User", function(request, response) {
var user = request.object;
if (!user.get("profilePhoto")) {
response.error("Users must have a profile photo.");
return;
}
if (!user.dirty("profilePhoto")) {
@fatuhoku
fatuhoku / .gitignore
Created November 13, 2015 23:25
.gitignore for iOS projects
View .gitignore
# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
@fatuhoku
fatuhoku / JHGradientView.swift
Last active November 12, 2015 23:47 — forked from jhays/JHGradientView.swift
GradientView - Editable in Interface Builder
View JHGradientView.swift
//
// JHGradientView.swift
// Gradient View editable in Interface Builder
//
// Created by JHays on 2/20/15.
// Copyright (c) 2015 Orbosphere. All rights reserved.
//
import Foundation
import UIKit
@fatuhoku
fatuhoku / AppDelegate.m
Last active August 29, 2015 14:25
Default React Native AppDelegate implementation
View AppDelegate.m
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
@fatuhoku
fatuhoku / Auto-adjust popover size based on preferredSize of topViewController
Created November 4, 2014 23:31
Make popover resize according to the preferredSizes of ViewControllers
View Auto-adjust popover size based on preferredSize of topViewController
// Conform to UINavigationControllerDelegate and then implement this:
// Especially if the topViewController is a RBStoryboardLink or something.
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
// NB: Using navigationController.preferredContentSize would be better here, but it doesn't reset properly when navigating back so we manually add on the height of the navbar instead.
CGSize size = viewController.preferredContentSize;
CGFloat navbarHeight = navigationController.navigationBar.frame.size.height;
<topViewController>.preferredContentSize = CGSizeMake(size.width, size.height + navbarHeight);