Shorthand if statement (Ternary Conditional Operator)

I never remember the syntax, or name, for Ternary Conditional Operator.

becomes

Apple documentation here.

Transparently redirect your root directory to a subdirectory

DreamHost has instructions here.
Make a text file called .htaccess with the following code and upload it to the domain’s root directory.

Alternatively.

How to do a lightweight Core Data migration in Swift

Here’s a stack overflow post on the topic.
Define migrationOptions to be used in persistentStoreCoordinator

Inclue options in:

It should end up like this:

Similarly in Objective C. Thanks @rockvotes

Submitting apps to the App Store with Dynamic Libraries

I was trying to submit a proof of concept app to the app store for TestFlight distribution. Submission failed.
Looked up Mapbox to see if there was a new version. No.
Looked up Mapbox to see if I was missing something in their instructions. No
A quick google search, lead me to a stack overflow post, which linked to another, which linked to this: Stripping Unwanted Architectures From Dynamic Libraries In Xcode
Copy, paste,

(might need to follow step 0 from here)
Archive, submit.
Upload Successful

Crayon Themes for lang:sh

Xcode Run Script to Auto-increment Build Number

Auto-incrementing build number.

  • 0. Target -> Build Phases -> Target Dependencies. Click on “Add target dependencies here” area (Xcode bug to get step 1 not greyed out)
  • 1. Editor -> Add Build Phase -> Add Run Script Build Phase
  • 2. Paste this code
  • 3. Change CFBundleDisplayName prefix. eg. Ped
  • 4. Add Row Bundle display name (aka CFBundleDisplayName) to Info.plist

Code snippets

Adding code snippets to WordPress

  • Search plugins for syntax.
  • Install Crayon.
  • Read documentation.
  • Use <pre> tags in “Text” mode as shown below.


<pre class="lang:swift" title="A snippet of code">
import UIKit
class SampleClass: NSObject {
var variable:Double
}
</pre>

  • End up with something like this:

It’s that easy!