This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
//1 create view with a title property | |
class TestView : UIView { | |
var title: String? | |
var rank: Int? | |
init(title: String, rank: Int) { | |
self.title = title | |
self.rank = rank |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code runs in a playground in Swift 3.0.1 | |
import Cocoa | |
var str = "Hello, playground" | |
/* | |
MPI | |
dec 2 2016 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wrote this to test out how Arrays of Dictionaries are handled | |
// was surprised to see they become tuples in a for-in | |
// also some unintuitive string conversions | |
import Cocoa | |
func c() -> [String:Any] { | |
print ( "ok" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
so A and B are structurally identical | |
C reverses the order of the 8 and 32 bit Ints | |
and D substitutes a string for the Int8 | |
then I try to read aaaa’s bits using B C and D overlays 😊 | |
C is printing the 8 bits of the A integer j and then the first 8 bits of integer k but somehow that still works out to one | |
when I hit D it doesn’t find a string so prints a blank | |
but the important point is: it doesn’t check anything, and doesn’t crash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
so this works as expected: | |
let conq = DispatchQueue(label: "ok", qos: .background, attributes: .concurrent ) | |
// let conq = DispatchQueue.global(qos: .userInitiated) | |
let dw1 = DispatchWorkItem { | |
//sleep(2) | |
print("dw1") | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "FoundationLocks.h" | |
#import "os/lock.h" | |
@implementation LockableObject | |
os_unfair_lock _lock; | |
- (instancetype) init { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pretending this is a subsystem | |
let holdval = HoldAValue() | |
var avalue: Int { | |
var i: Int = 0 | |
DispatchQueue.global(qos: .userInitiated).sync { | |
i = holdval.anIntValue | |
} | |
return i | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dispatchGroup = DispatchGroup() | |
let dq = DispatchQueue.global(qos: .utility) | |
dq.async { | |
for i in 0...3{ | |
dq.async { | |
print("\n i - \(i)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################### | |
# .gitignore file for Xcode4 / OS X Source projects | |
# | |
# NB: if you are storing "built" products, this WILL NOT WORK, | |
# and you should use a different .gitignore (or none at all) | |
# This file is for SOURCE projects, where there are many extra | |
# files that we want to exclude | |
# | |
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
######################### |