gitflow | git |
---|---|
git flow init |
git init |
git commit --allow-empty -m "Initial commit" |
|
git checkout -b develop master |
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
#!/bin/sh | |
# Script for managing build and version numbers using git and agvtool. | |
# Change log: | |
# v1.0 18-Jul-11 First public release. | |
# v1.1 29-Sep-12 Launch git, agvtool via xcrun. | |
version() { |
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
import Foundation | |
/// Find first differing character between two strings | |
/// | |
/// :param: s1 First String | |
/// :param: s2 Second String | |
/// | |
/// :returns: .DifferenceAtIndex(i) or .NoDifference | |
public func firstDifferenceBetweenStrings(s1: NSString, s2: NSString) -> FirstDifferenceResult { |
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
struct ExpressionErased : Chainable { | |
var chainType: SQLiteChainType = .None | |
let __andOperator:((rhs:Chainable) -> [Chainable]) | |
init<T : Chainable>(expression:T) { | |
self.__andOperator = expression.andOperator | |
} | |
func andOperator(rhs: Chainable) -> [Chainable] { | |
return self.__andOperator(rhs: rhs) |
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
class Pub {init?(){}}; | |
let zoo = false ? Pub() : nil | |
func bar() -> Pub? { return nil }; | |
let boo = false ? bar() : nil | |
func foo() -> Pub { return Pub()! }; | |
let poo = false ? foo() : nil // can't |
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
let keys = [ | |
1 : ["value" : "FirstValue", "dependencies" : Set(arrayLiteral: 2)], | |
2 : ["value" : "SecondValue", "dependencies" : Set(arrayLiteral: 1)], | |
] | |
keys.reduce(Dictionary<Set<Int>, Set<Int>>()) { (allDependencies, keyValueTuple) in | |
let (key, content) = keyValueTuple | |
var dependencyGraph = allDependencies | |
let dependencyKey = (content["dependencies"] as! Set<Int>).union([key]) |
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
func crap<T>(arg:T) { | |
print(String(T)) | |
print(String(arg)) | |
print(Mirror(reflecting: arg)) | |
print(Mirror(reflecting: arg).subjectType) | |
print(String(Mirror(reflecting: arg))) | |
print(String(Mirror(reflecting: arg).subjectType)) | |
} |
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 CollectionType { | |
private func flatMap<S : SequenceType>(transform: (Self.Generator.Element) throws -> S) rethrows -> Set<S.Generator.Element> { | |
return | |
Set( | |
try self | |
.map(transform) | |
.filter { $0 != nil } | |
.map { $0! } | |
.flatten() | |
) |
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
import Foundation | |
struct Stream { | |
let string: NSString | |
var position: Int | |
var matchingRange: NSRange { | |
return NSRange(location: position, length: string.length - position) | |
} | |
} |
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
//: Responder chain in Swift using enums | |
protocol CommandProtocol {} | |
protocol Responder: class { | |
var nextResponder: Responder? { get } | |
func performerForCommand | |
<Command : CommandProtocol> | |
(command: Command) -> (() -> ())? |