This file contains hidden or 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 CoreGraphics | |
private typealias CGPathDumpUtility = CGPath | |
extension CGPathDumpUtility { | |
func dump() { | |
self.apply(info: nil) { info, unsafeElement in | |
let element = unsafeElement.pointee | |
switch element.type { |
This file contains hidden or 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 Cocoa | |
class ViewController: NSViewController { | |
var timer : Timer? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { timer in |
This file contains hidden or 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
- (CGImageRef) newMaskFromImage: (UIImage *) image { | |
// Prior to 10.2 SDK / Xcode 8 (dunno which it is), the mask creation worked | |
// for all of the bucket overflow images. It failed afterwards. Dunno if the | |
// pngcrushing changed the color space unexpectedly, or what. But trying one and | |
// then falling back to the other seems to work ok now. | |
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB (); | |
CGImageRef maskRef = CGImageCreateCopyWithColorSpace (image.CGImage, cs); | |
This file contains hidden or 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
// | |
// Copyright © 2015 Big Nerd Ranch | |
// | |
import UIKit | |
class ImageStore { | |
let cache = NSCache<NSString, UIImage>() | |
This file contains hidden or 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 | |
class Stack<T> { | |
var storage = [T]() | |
func push(_ thing: T) { | |
storage.append(thing) | |
} | |
func pop() -> T { |
This file contains hidden or 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
I am not a fan of Xcode. Here are ~160~ 200 problems, the first hundred or so issues were filed mostly in | |
July and August 2016 in a fit of rage. Mostly on weekends working (slowly) on side-projects. I have also | |
taken days of my employer's time filing others of these - so the company was not getting value for my time. | |
I believe a paid intern could have found many of these - just start a screen recorder, and when you see something, | |
stop and cut a quick movie. Many have been around for several major versions. | |
I'm volunteering chunks of my life (15-30 minutes per) to one of the most valuable companies in the world, which seems | |
kind of messed up. Things get worse the more complex the project and the longer Xcode been's running. | |
Apple folks - check out rdar://22524679 |
This file contains hidden or 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
How many children were you meant to have? Heptapentuplets :-( | |
This inkblot test will assess your personality. Please stay where you are, we will be visiting shortly :-( | |
Can we guess your level of education? Stop eating your crayons :-( | |
What song sums up your entire life? Revolution #9 | |
How Weird (percentage) are you? Sqwank :-( | |
Which Children's Book was written about you? The Night Dad Went To Jail :-( | |
Which Superhero are you in teh Comic World? Rorschach :-( | |
Which Keirsey Personality Type are You? Degenerate :-( | |
If you could write a note to your younger self, what would you say in only two words? sesquipedalian rhetoric | |
What is your maturity Level? "java.lang.Number.exception - negative number found" :-( |
This file contains hidden or 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
NSUserCancelledError = 3072, // User cancelled operation (this one often doesn't deserve a panel and might be a good one to special case) | |
If you cancel an outstanding request (via the cancel method on the NSProgress object, or cancelling a parent progress object you have created) the completion handler argument to this method will be called back with an NSUserCancelledError in the NSCocoaErrorDomain. | |
BOOL _isCancelled; | |
/* Cancel all invocations of -coordinate... and -prepare... methods for the receiver. Any current invocation of one of those methods will stop waiting and return immediately, unless it has already invoked the passed-in block, in which case it will return when the passed-in block returns. Subsequent invocations of those methods will not invoke the blocks passed into them at all. When an invocation of -coordinate... or -prepare... returns without invoking the passed-in block because this method was invoked it instead returns an error whose domai |
This file contains hidden or 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 <stdio.h> | |
// xcrun clang -g -Wall -Werror -fprofile-instr-generate -fcoverage-mapping -o testprof testprof.m | |
// ./testprof | |
// xcrun llvm-profdata merge -o testprof.profdata default.profraw | |
// xcrun llvm-cov show ./testprof -instr-profile=testprof.profdata testprof.m | |
static int DoSomething (int value) { | |
if (value == 55) { |
This file contains hidden or 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
chapter_tree = ET.parse('Chapter.xml') | |
chapter_root = chapter_tree.getroot() | |
for para in chapter_root.iter('{http://docbook.org/ns/docbook}para'): | |
print para.text | |
<para> | |
In this chapter, you will focus on the authentication piece. You will | |
extend the Catalog app to provide a username and password when using |