UIViews are like Ogres, which are like onions – they have layers. Source: Documentation More accurately, UIView has a single layer property that can have infinite sublayers. UIView’s have layers Lets draw a circle. First create a UIView and a CAShapeLayer: let myView = UIView() let myLayer = CAShapeLayer() Layers have a path UIBezierPath makes drawing shapes…
iOS Application Lifecycle – UIKit basics
iOS applications are all about cycles This is because the iOS applications are richly interactive when it comes to user input and much of your programming with UIKit will be delegate oriented. Knowing the many different “cycles” of the device and application will be illuminating for your development. States of the UIKit App Cycle * These are the…
iOS without storyboard
Why? Programmatically/Code or NIB based layouts are a much better fit for projects that use version control (see merge conflicts) and make it much easier to reuse views. If you are deciding not to use storyboards, you will need to manually set your application window to your desired UIWindow Prerequisites: – Delete Main Interface from Deployment…
Forgetting to set translatesAutoresizingMaskIntoConstraints to false
UIKit on iOS is great! There are tons of tools and often this can supercharge your productivity for getting a prototype out into the world. Additionally, working with AutoLayout programmatically can be great if you avoid these rookie mistakes. Rookie Mistake 1: It hurts when you spend hours dealing with the rookie mistake of forgetting to…
Delete files by filename with “find”
When you upload photos multiple times, the computer can start numbering the photos. IMG_A becomes IMG_A 1 and IMG_A 2 and IMG_A 3. Using a wildcard * and specifying the ending space and number will help you select the files. For example: Find all the files that end in “space”1.JPG find -name ‘* 1.JPG’ * Have a look at the…
Setting environment variables
How to see and set your environment variables Print all your current environment variables with $ printenv See a the value for a specific variable with echo $ printenv <YOUR_VARIABLE> or $ echo $<YOUR_VARIABLE> For example: $ printenv MY_API_KEY or $ echo $MY_API_KEY How do I set the variable temporarily? This will set your variable for ONLY…
Postgres tutorial – installing with brew + basics (old)
Updated and vastly improved version (July 8th 2024): link Step 1: Install postgres brew install postgres Step 2: Start postgres server brew services start postgresql Step 3: Create a database Lets call our database “book” $ createdb book Step 4: open the psql shell List all databases in terminal with: $ psql –list Adding the…
Heroku: Node, Express, PostgreSQL Setup
Step 0: Have an app Create an empty app if you dont have one Create a folder, cd into it and initialize your git repo. $ mkdir <app_name>; cd <app_name>; git init Step 1: Install Heroku Install the heroku cli with homebrew $ brew install heroku/brew/heroku Check your heroku installation and login if necessary: $ heroku…
Installing Python and managing Python versions with pyenv (bonus venv)
Step 1: Meet your default python You are on Mac OS. When you run python in your terminal you see this. You have Python 2.7.10. This is your default python. You can do things like add > 8+8 Step 2: Meet your modules From your interpreter you can see your available modules by asking for “help”…
Levels of installing python
This is an opinionated route towards python management. Every computer may have its own set up. Level 0: “I just want to play with python” Method 1: Use and online REPL like this: https://repl.it/languages/python Level 1: “I want python on my computer” Download brew, use brew to download the latest version of python and go crazy.…