Skip to content

Instantly share code, notes, and snippets.

@jkhowland
Created August 10, 2014 16:44
Show Gist options
  • Save jkhowland/e8cdbdeaee322080ea6d to your computer and use it in GitHub Desktop.
Save jkhowland/e8cdbdeaee322080ea6d to your computer and use it in GitHub Desktop.
GitReference - Data Methods - Swift
func gitCommands() -> Array<[String: String]> {
var commands = [[String: String]]()
commands.append([Command: "git status", Reference: ": shows changed files"])
commands.append([Command: "git diff", Reference: ": shows actual changes"])
commands.append([Command: "git add .", Reference: ": adds changed files to the commit"])
commands.append([Command: "git commit -m \"notes\"", Reference: ": commits the changes"])
commands.append([Command: "git push origin _branch_", Reference: ": pushes commits to branch named _branch_"])
commands.append([Command: "git log", Reference: ": displays progress log"])
commands.append([Command: "git comment --amend", Reference: ": re-enter last commit message"])
return commands
}
func heightOfReferenceString(string: String, constrainedToWidth width: CGFloat) -> CGFloat {
return (string as NSString).boundingRectWithSize(CGSize(width: width, height: 100.0),
options: NSStringDrawingOptions.UsesLineFragmentOrigin,
attributes: [NSFontAttributeName: self.referenceFont()],
context: nil).size.height
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment