mkdir"ProjectFolder"
- Navigate to Github.com and create a new repository
- Enter the repo name
| Command | Summary |
|---|---|
| cd ~/Documents | navigate to the documents directory of your mac |
| pwd | show current directory |
| ls | list contents of current directory |
| mkdir GitIntro | create a folder named GitIntro |
| cd GitIntro | navigate to the newly created GitIntro folder |
| echo "Github Introduction" >> README.md | create a markdown file called README.md |
| Command | Summary |
|---|---|
| git init | initializes (creates) a git repository in the current directory |
| ls -a | list hidden files |
| git status | show status of your local repository |
| git add README.md | add the untrack file to be committed |
| git commit -m "initial commit" | commit and include a message about your commit |
| git remote add origin `` | configure the remote repository |
There is a hidden file in your Mac’s user directory named .bash_profile. This file is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface. Within it you can change your terminal prompt, change the colors of text, add aliases to functions you use all the time, and so much more.
If you run the open ~/.bash_profile command and do not have a current .bash_profile, follow these steps to create one:
- Open Terminal
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
| // Apple Documentation: https://developer.apple.com/documentation/swift/uint64/2885895-addingreportingoverflow | |
| let intMin = Int.min // -9223372036854775808 | |
| let intMax = Int.max // 9223372036854775807 | |
| print(intMin) | |
| print(intMax) | |
| if case let (result, overflow) = intMax.addingReportingOverflow(1), !overflow { | |
| print(result) | |
| } else { | |
| print("overflow while trying to add to Int.max") |
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
| // Date extension | |
| extension Date { | |
| static func getStringFromDate(date: Date) -> String { | |
| let dateFormatter = DateFormatter() | |
| dateFormatter.dateFormat = "EEEE, MMM d, yyyy" | |
| let dateString = dateFormatter.string(from: date) | |
| return dateString | |
| } | |
| static func getDateFromString(dateString: String) -> Date? { | |
| let formatter = ISO8601DateFormatter() |
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
| // working with String index | |
| let str = "The Swift Programming Language" | |
| // accessing the first character | |
| print("the first character is \(str[str.startIndex])") | |
| // accessing the last character | |
| print("the last character is \(str[str.index(before: str.endIndex)])") |
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
| class ViewController: UIViewController { | |
| @IBOutlet weak var tableView: UITableView! | |
| private var cities = ["new york", "boston", "chicago", "stockholm"] | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| } | |
| override func prepare(for segue: UIStoryboardSegue, sender: Any?) { |