Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.
Informative DevForum posts from everyone's favorite DTS member.
(Arranged newest to oldest)
static NSData *PSPDFCalculateSHA256FromFileURL(NSURL *fileURL, CC_LONG dataLength, NSError **error) { | |
NSCParameterAssert(fileURL); | |
dispatch_queue_t shaQueue = dispatch_queue_create("com.pspdfkit.sha256-queue", DISPATCH_QUEUE_SERIAL); | |
__block dispatch_io_t readChannel; | |
void (^processIntError)(int intError) = ^(int intError) { | |
if (intError != 0) { | |
PSPDFLogWarning(@"Stream error: %d", intError); | |
if (error) *error = [NSError errorWithDomain:@"SHA256Error" code:100 userInfo:@{NSLocalizedDescriptionKey: @"failed to open file for calculating SHA256."}]; |
static NSData *PSPDFCalculateSHA256FromFileURL(NSURL *fileURL, CC_LONG dataLength, NSError **error) { | |
NSCParameterAssert(fileURL); | |
NSData *shaData; | |
int fd = open(fileURL.path.UTF8String, O_RDONLY); | |
if (fd < 0) { | |
if (error) *error = [NSError pspdf_errorWithCode:PSPDFErrorCodeUnableToOpenPDF description:@"Failed to open file for calculating SHA256."]; | |
return nil; | |
} |
//disable TOC button | |
window.HelpViewer.showTOCButton(false); | |
//enable TOC button | |
//If you call this on window load it will flash active for a brief second and then disable again. | |
//Call if after a delay of 250ms and is works fine | |
//Not sure what the second variable does yet, but passing false works fine | |
window.HelpViewer.showTOCButton( true, false, function() { | |
//do something to toggle TOC in your webpage | |
}); |
// | |
// DON'T do this, or else you risk a deadlock (e.g., by accidentally performing it in a different order somewhere) | |
// | |
dispatch_async(firstQueue, ^{ | |
dispatch_sync(secondQueue, ^{ | |
// code requiring both queues | |
}); | |
}); |
#!/bin/bash | |
# | |
# Faster toolchain build: skips as much as possible. | |
# | |
# To use this toolchain from the command line:" | |
# export TOOLCHAINS=$(whoami) | |
# | |
# we build to the same prefix every time (instead of building | |
# to a versioned prefix) because every time the prefix changes | |
# *everything* rebuilds. |
import Dispatch | |
import Foundation | |
var x = 7 | |
let dd = withUnsafeBytes(of: &x, { DispatchData.init(bytes: $0) }) | |
print(dd as? Data) // Case 1: nil | |
print(dd as? NSData) // Case 2: nil | |
print(dd as Any as? Data) // Case 3: nil | |
print(dd as Any as? NSData) // Case 4: .some | |
print(dd as Any as? NSData as Data?) // Case 5: .some |
import UIKit | |
/// A wrapper view controller that makes the horizontal size class | |
/// be based on both the Dynamic Text size and the width available. | |
class AdaptiveTraitsContainer: UIViewController { | |
let wrappedViewController: UIViewController | |
init(wrappedViewController: UIViewController) { | |
self.wrappedViewController = wrappedViewController | |
super.init(nibName: nil, bundle: nil) |
public typealias LosslessStringCodable = LosslessStringConvertible & Codable | |
@propertyWrapper | |
public struct LosslessCodable<Value: LosslessStringCodable>: Codable { | |
private let type: LosslessStringCodable.Type | |
public var wrappedValue: Value | |
public init(wrappedValue: Value) { | |
self.wrappedValue = wrappedValue |
Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.
Informative DevForum posts from everyone's favorite DTS member.
(Arranged newest to oldest)