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
# | |
# https://gist.github.com/johankool/c33cffc0727b13f22f25 | |
# Set the build number to the current git commit count. | |
# If we're using the Dev scheme, then we'll suffix the build | |
# number with the current branch name, to make collisions | |
# far less likely across feature branches. | |
# Based on: | |
# http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/ | |
# http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build#fnref:p97193356620-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
import Foundation | |
import UIKit | |
struct ViewStyle<T> { | |
let style: (T) -> Void | |
} | |
let filled = ViewStyle<UIButton> { | |
$0.setTitleColor(.white, for: .normal) | |
$0.backgroundColor = .red |
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
val mainParams = MainNetParams.get() | |
// Create transaction | |
val tx = Transaction(mainParams) | |
val wallet = Wallet(mainParams) | |
// decode private key | |
val privateKey = BIP38PrivateKey.fromBase58(mainParams, encryptedKey).decryptWithParams(decryptKey, 2048, 8, 8) |
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
//JSON is created using the awesome SwiftyJSON pod | |
func json2dic(j: JSON) -> [String:AnyObject] { | |
var post = [String:AnyObject]() | |
for (key, object) in j { | |
post[key] = object.stringValue | |
if object.stringValue == "" { | |
post[key] = json2dic(object) | |
} | |
} | |
return post |
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
//Swift | |
var secret: String { | |
var _secret = "" | |
#if TARGET_NAME_HERE | |
_secret = "5Phtn5oNbLL8gwHDhtJxNRVW64hqwe9oNML08a4oDhtnxNRVW688COlZFSWs" | |
#else | |
_secret = "fs5dUMzKL82KLe9oNML08a4oDhtn5oNbLL8gwHDhR3tJxNRVW688COlZFSWS" | |
#endif | |
return _secret | |
} |
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
NSOrderedSet *orderedSet = [NSOrderedSet orderedSetWithArray:_lastMessages]; | |
NSArray *arrayWithoutDuplicates = [orderedSet array]; | |
NSSortDescriptor *dateDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"date_" ascending:YES]; | |
NSArray *sortDescriptors = [NSArray arrayWithObject:dateDescriptor]; | |
NSArray *sortedEventArray = [arrayWithoutDuplicates sortedArrayUsingDescriptors:sortDescriptors]; | |
_lastMessages = [sortedEventArray mutableCopy]; |
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
//String to NSDate | |
var dateString = "01-02-2010" | |
var dateFormatter = NSDateFormatter() | |
//// this is imporant - we set our input date format to match our input string | |
dateFormatter.dateFormat = "dd-MM-yyyy" | |
var dateFromString = dateFormatter.dateFromString(dateString) | |
//NSDate to String | |
var formatter: NSDateFormatter() | |
formatter.dateFormat = "dd-MM-yyyy" |