This file contains hidden or 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
| import Foundation | |
| import CFNetwork | |
| public class FTPUpload { | |
| fileprivate let ftpBaseUrl: String | |
| fileprivate let directoryPath: String | |
| fileprivate let username: String | |
| fileprivate let password: String | |
This file contains hidden or 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
| import Foundation | |
| func add(_ char:Character, to input:String, pattern:[UInt]) -> String { | |
| guard pattern.reduce(0, +) > 0 else { return input } | |
| var str = input | |
| var index:String.Index? = str.startIndex | |
| var i = 0 | |
| while index != nil { | |
| let offset = pattern[i%pattern.count] | |
| i += 1 |
This file contains hidden or 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
| // | |
| // NibBaseViewController.swift | |
| // | |
| // Created by Maciej Gad on 23/09/2018. | |
| // Copyright © 2018 Maciej Gad. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
This file contains hidden or 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
| #!/bin/bash | |
| info="Info.plist" | |
| plistBuddy=/usr/libexec/PlistBuddy | |
| version=`$plistBuddy -c "print CFBundleVersion" "$info"` | |
| echo "Current version: $version" | |
| ((version++)) | |
| echo "New version: $version" | |
| $plistBuddy -c "set CFBundleVersion $version" "$info" |
This file contains hidden or 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 UITabBarController { | |
| func set(visible: Bool, animated: Bool, completion: ((Bool)->Void)? = nil ) { | |
| guard isVisible() != visible else { | |
| completion?(true) | |
| return | |
| } | |
| let offsetY = tabBar.frame.size.height |
This file contains hidden or 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
| import Foundation | |
| import UIKit | |
| enum NibBaseError:Error { | |
| case badClassName | |
| case noNibFile | |
| case noStoryboard | |
| } | |
| class NibBaseViewController: UIViewController, IsNibBaseViewController { |
This file contains hidden or 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 NSImage { | |
| /// Returns the height of the current image. | |
| var height: CGFloat { | |
| return self.size.height | |
| } | |
| /// Returns the width of the current image. | |
| var width: CGFloat { | |
| return self.size.width |
This file contains hidden or 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
| //remember to intall AFNetworking https://github.com/AFNetworking/AFNetworking#installation-with-cocoapods | |
| //and add import : | |
| //#import "UIImageView+AFNetworking.h" | |
| - (void)setImageFromDictionary:(NSDictionary *)dic2 { | |
| NSString *path = dic2[@"safe_value"]; | |
| if (![path isKindOfClass:[NSString class]]) { | |
| return; | |
| } | |
| NSURL *imageUrl = [NSURL URLWithString:path]; |
This file contains hidden or 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
| enum Tower:String { | |
| case A | |
| case B | |
| case C | |
| } | |
| func hanoi(_ disk: Int, from: Tower, using: Tower, | |
| to: Tower, output: inout [String]) { | |
| if disk == 1 { | |
| output.append("\(from.rawValue)->\(to.rawValue)") |
This file contains hidden or 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
| if [ "$CONFIGURATION" = "Ad hoc" ] || [ "$CONFIGURATION" = "Release" ]; then | |
| echo "Bumping build number..." | |
| plist=${PROJECT_DIR}/${INFOPLIST_FILE} | |
| buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}") | |
| if [[ "${buildnum}" == "" ]]; then | |
| echo "No build number in $plist" | |
| exit 2 | |
| fi |
NewerOlder