Skip to content

Instantly share code, notes, and snippets.

View alexpaul's full-sized avatar
:octocat:

Alex Paul alexpaul

:octocat:
View GitHub Profile
@alexpaul
alexpaul / alphabets.md
Created October 4, 2018 16:29
An empty alphabet list

A

B

C

D

E

@alexpaul
alexpaul / RepoSteps.md
Last active September 25, 2019 18:07
Steps to create a local repo using git init and push to a remote Github repo

Steps to create a local repo on your machine using Terminal and push to Github

Create Folder in Terminal

  1. mkdir "ProjectFolder"

Github.com

  1. Navigate to Github.com and create a new repository
  2. Enter the repo name
@alexpaul
alexpaul / Terminal-Commands.md
Last active October 7, 2018 11:34
Terminal Commands

Terminal Commands

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
@alexpaul
alexpaul / Git-Commands.md
Last active June 5, 2019 20:19
Git commands

Git Commands

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
@alexpaul
alexpaul / Bash.md
Last active February 9, 2025 02:05
Creating a Bash Profile

Bash

What is a bash_profile

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.

Creating a .bash_profile

If you run the open ~/.bash_profile command and do not have a current .bash_profile, follow these steps to create one:

  1. Open Terminal
@alexpaul
alexpaul / AppPreview.md
Last active October 14, 2018 10:45
Capture video for App Store Preview

Steps to capture video for App Store preview

  1. Use Quicktime to capture the app running on an iOS device
  2. Use ffmpeg to adjust the frame rate to the required 30 fps.
  3. Don't have ffmpeg? Install using homebrew > brew install ffmpeg
  4. ffmeg command > ffmpeg -i input.mov -r 30 output.mov
@alexpaul
alexpaul / Overflow-Arithmetic-Check.swift
Created October 31, 2018 14:40
Checking for overflow arithmetic operations in Swift, e.g adding to Int.max and subtracting from Int.min
// 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")
@alexpaul
alexpaul / Date.swift
Last active November 10, 2024 11:36
Using Date in Swift, using ISO8601DateFormatter() and DateFormatter()
// 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()
@alexpaul
alexpaul / String-Index.swift
Created November 2, 2018 21:45
Working with String.Index
// 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)])")
@alexpaul
alexpaul / Sample-Delegates.swift
Created November 26, 2018 23:03
Some sample built-in delegates in iOS
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?) {