This file contains 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
function peco_select_repository | |
if test (count $argv) = 0 | |
set peco_flags --layout=bottom-up | |
else | |
set peco_flags --layout=bottom-up --query "$argv" | |
end | |
ghq list -p | peco $peco_flags | perl -pe 's/([ ()])/\\\\$1/g'| read foo | |
if [ $foo ] |
This file contains 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
UIView.setAnimationsEnabled(false) | |
self?.beginUpdates() | |
self?.endUpdates() | |
UIView.setAnimationsEnabled(true) |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
extension UIViewController { | |
var previousViewController: UIViewController? { | |
guard let navigationController = navigationController else { return nil } | |
let count = navigationController.viewControllers.count | |
return count < 2 ? nil : navigationController.viewControllers[count - 2] | |
} | |
} |
This file contains 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
// Hide | |
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.bounds.width, bottom: 0, right: 0) | |
cell.layoutMargins = UIEdgeInsetsZero | |
// Show | |
cell.separatorInset = UIEdgeInsetsZero | |
cell.layoutMargins = UIEdgeInsetsZero |
This file contains 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
final class SwipeContainerViewController: UIPageViewController { | |
convenience init() { | |
self.init(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil) | |
} | |
override init(transitionStyle style: UIPageViewControllerTransitionStyle, navigationOrientation: UIPageViewControllerNavigationOrientation, options: [String : AnyObject]?) { | |
super.init(transitionStyle: style, navigationOrientation: navigationOrientation, options: options) | |
} | |
This file contains 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
final class SearchContainerViewController: UIViewController { | |
let hoge: Hoge | |
convenience init(hoge: Hoge) { | |
self.init(nibName: nil, bundle: nil) | |
self.hoge = hoge | |
} | |
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) { super.init(nibName: nil, bundle: nil) } | |
required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } |
This file contains 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
final class OverridedCell: UITableViewCell { | |
static let identifier = "OverridedCell" | |
override init(style: UITableViewCellStyle, reuseIdentifier: String?) { | |
super.init(style: style, reuseIdentifier: reuseIdentifier) | |
prepareView() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") |
This file contains 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
let transition = CATransition() | |
transition.duration = 0.2 | |
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) | |
transition.type = kCATransitionFade | |
navigationController?.view.layer.addAnimation(transition, forKey: nil) | |
navigationController?.pushViewController(con, animated: true) |