Skip to content

Instantly share code, notes, and snippets.

View joamafer's full-sized avatar

Jose Antonio joamafer

  • ClearScore
  • Cordoba
View GitHub Profile
@joamafer
joamafer / WeakSelf
Last active November 13, 2015 14:03
WeakSelf
#define WeakSelf __weak __typeof(self) weakSelf = self
@joamafer
joamafer / FIXME and TODO
Created November 16, 2015 16:41
Script to highlight the lines for FIXME and TODO
KEYWORDS="TODO:|NOTE:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}/Classes" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@joamafer
joamafer / Delete cache CocoaPods
Created March 14, 2016 11:39
Delete cache CocoaPods
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@joamafer
joamafer / CoreDataStack.swift
Created October 31, 2016 21:10
CoreDataStack for iOS 9 and 10. Supporting Swift 3.0
//
// CoreDataStack.swift
// Jose
//
// Created by JOSE ANTONIO MARTINEZ FERNANDEZ on 31/10/2016.
// Copyright © 2016 joamafer. All rights reserved.
//
import UIKit
import CoreData
@joamafer
joamafer / gist:56368f55131f2e4170d9ac482b7c0064
Created January 22, 2017 00:55
Add child UIViewController to UIView
func add(viewController: UIViewController, toContainerView containerView: UIView) {
viewController.view.translatesAutoresizingMaskIntoConstraints = false
addChildViewController(viewController)
containerView.addSubview(viewController.view)
viewController.didMove(toParentViewController: self)
viewController.view.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
viewController.view.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true
viewController.view.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true
viewController.view.rightAnchor.constraint(equalTo: containerView.rightAnchor).isActive = true
}