Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh
into the pre-action script box.
#!/bin/sh | |
set -e | |
# First we are going to make sure that you understand this is sort of experimental and we will be compiling stuff. | |
# by default CONTINUE will be false | |
CONTINUE=false | |
echo "" | |
echo "You are about to download, compile, and install stuff on your computer." |
Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh
into the pre-action script box.
import Foundation | |
struct Country { | |
let name: String | |
let capital: String | |
var visited: Bool | |
} | |
extension Country: Equatable { | |
static func == (lhs: Country, rhs: Country) -> Bool { |
#! /usr/bin/env ruby | |
# NOTE: Requires Ruby 2.1 or greater. | |
# This script can be used to parse and dump the information from | |
# the 'html/contact_info.htm' file in a Facebook user data ZIP download. | |
# | |
# It prints all cell phone call + SMS message + MMS records, plus a summary of each. | |
# | |
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
/* Scroll to the bottom for examples */ | |
typealias WritableObjectKeyPath<O: NSObject, V: Equatable> = (object: O, keyPath: WritableKeyPath<O, V>) | |
typealias ReadOnlyObjectKeyPath<O: NSObject, V: Equatable> = (object: O, keyPath: KeyPath<O, V>) | |
func bind<O: NSObject, O2: NSObject, V: Equatable>(source: ReadOnlyObjectKeyPath<O, V>, to target: WritableObjectKeyPath<O2, V>) -> NSKeyValueObservation? |
//: Playground - noun: a place where people can play | |
import UIKit | |
/* Scroll to the bottom for examples */ | |
typealias WritableObjectKeyPath<O: NSObject, V: Equatable> = (object: O, keyPath: WritableKeyPath<O, V>) | |
typealias ReadOnlyObjectKeyPath<O: NSObject, V: Equatable> = (object: O, keyPath: KeyPath<O, V>) | |
func bind<O: NSObject, O2: NSObject, V: Equatable>(source: ReadOnlyObjectKeyPath<O, V>, to target: WritableObjectKeyPath<O2, V>) -> NSKeyValueObservation? |
(declaim (ftype (function (fixnum function) ) triples)) | |
(time | |
(defun triples (n func) | |
(declare (optimize (speed 3) (debug 0) (safety 0))) | |
(declare (type function func) | |
(type fixnum n)) | |
(let ((count 0)) | |
(declare (type fixnum count)) | |
(loop for z fixnum from 1 do | |
(loop for x fixnum from 1 to z do |
Simulation Begin | |
! We will use this as input to Normal() below ; | |
Integer seed; | |
! Utility method for logging messages along with the current simulation | |
time ; | |
Procedure log(message); Text message; Begin | |
OutFix(Time, 2, 0); | |
OutText(": " & message); | |
OutImage; |