sudo ifconfig lo0 alias 10.254.254.254
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
import Foundation | |
public struct IdentityAndTrust { | |
public var identityRef:SecIdentity | |
public var trust:SecTrust | |
public var certArray:NSArray | |
} | |
public func extractIdentity(certData:NSData, certPassword:String) -> IdentityAndTrust { | |
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { | |
// Page width used for estimating and calculating paging. | |
let pageWidth = (self.frame.width) - interIntemMargin | |
// Make an estimation of the current page position. | |
let approximatePage = scrollView.contentOffset.x/pageWidth | |
// Determine the current page based on velocity. | |
let currentPage = (velocity.x < 0.0) ? floor(approximatePage) : ceil(approximatePage) |
import UIKit | |
class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
guard let superArray = super.layoutAttributesForElements(in: rect), | |
let attributes = NSArray(array: superArray, copyItems: true) as? [UICollectionViewLayoutAttributes] else { return nil } | |
var leftMargin = sectionInset.left | |
var maxY: CGFloat = -1.0 |
import Foundation | |
import RxSwift | |
enum Either<T> { | |
case success(T) | |
case error(Swift.Error) | |
var successResult: T? { | |
switch self { | |
case .success(let result): |
import Foundation | |
enum Either<T> { | |
case success(T) | |
case error(Swift.Error) | |
var successResult: T? { | |
switch self { | |
case .success(let result): | |
return result | |
case .error(_): |
Generate a Bearer token to access Twitter REST API
- (void) generateAPIKeyWithCompletionBlock:(void (^)(BOOL success, NSString* twitterOAuthToken, NSString *error))completion {
//Network tasks should be in background thread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
//Generate Bearer Token according to Twitter Documentation
NSString* bearerToken = [NSString stringWithFormat:@"%@:%@", TWITTER_API_KEY , TWITTER_API_SECRET];
bearerToken = [[bearerToken dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0];
#Merge using strategie | |
git checkout --ours ( --theirs ) filename | |
#Restart merge | |
git checkout -m FILE |
#Reduce App Size