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
require 'optparse' | |
require 'xcodeproj' | |
options = {} | |
OptionParser.new do |opts| | |
opts.banner = " This script fills \"Compile sources\" and add headers to the project section. \n | |
Usage: fill_sources_headers.rb [options]" | |
opts.on("-s [sources_path]", "--sources [sources_path]", "Path to the sources files (required)") do |sources_path| |
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 NSAttributedString { | |
func replaceHTMLTag(tag: String, withAttributes attributes: [String: AnyObject]) -> NSAttributedString { | |
let openTag = "<\(tag)>" | |
let closeTag = "</\(tag)>" | |
let resultingText: NSMutableAttributedString = self.mutableCopy() as NSMutableAttributedString | |
while true { | |
let plainString = resultingText.string as NSString | |
let openTagRange = plainString.rangeOfString(openTag) | |
if openTagRange.length == 0 { |
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
// Make sure you add #import <CommonCrypto/CommonCrypto.h> to the Xcode bridging header! | |
enum CryptoAlgorithm { | |
case MD5, SHA1, SHA224, SHA256, SHA384, SHA512 | |
var HMACAlgorithm: CCHmacAlgorithm { | |
var result: Int = 0 | |
switch self { | |
case .MD5: result = kCCHmacAlgMD5 | |
case .SHA1: result = kCCHmacAlgSHA1 |