alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
import UIKit | |
typealias JSON = [String : Any] | |
fileprivate let imageCache = NSCache<NSString, UIImage>() | |
extension NSError { | |
static func generalParsingError(domain: String) -> Error { | |
return NSError(domain: domain, code: 400, userInfo: [NSLocalizedDescriptionKey : NSLocalizedString("Error retrieving data", comment: "General Parsing Error Description")]) | |
} | |
} |
# Enable timings on build operations | |
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES | |
# Enable extensive per-task timings | |
defaults write com.apple.dt.Xcode IDEBuildOperationTimingLogLevel -int 3 | |
# Enable old build system logging for "implicit dependencies" | |
defaults write com.apple.dt.Xcode IDEBuildOperationDependenciesLogLevel -int 3 | |
# Show logs from the "prebuild" step |
// https://stackoverflow.com/a/45777692/5536516 | |
import Foundation | |
struct MemoryAddress<T>: CustomStringConvertible { | |
let intValue: Int | |
var description: String { | |
let length = 2 + 2 * MemoryLayout<UnsafeRawPointer>.size |
import logging | |
import sys | |
from logging import config | |
# REF, modified from: | |
# https://stackoverflow.com/a/19367225 | |
if sys.platform == "darwin": | |
address = '/var/run/syslog' | |
facility = 'local1' |
import AVFoundation | |
var audioPlayer: AVAudioPlayer? | |
enum AudioLoader { | |
case fromResource(URL) | |
case fromAsset(NSDataAsset) | |
} | |
enum AudioLoaderError: Error { | |
case resourceNotFound |

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
-
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
-
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse
package com.dangets; | |
import com.squareup.moshi.Json; | |
import com.squareup.moshi.Moshi; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import retrofit2.Call; | |
import retrofit2.Response; | |
import retrofit2.Retrofit; |
Initialize the local Docker service as a swarm manager. As a guideline, in production you should have 3 to 5 managers. Swarm is managed through port 2377, which should be blocked from external access.
$ docker swarm init
Join an existing swarm as a worker node. Replace $SWARM_MANAGER with the IP address or domain name of a swarm manager node.