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
| We're working on supporting Bitcode in PSPDFKit but hit a blocking issue with OpenSSL (latest 1.0.2d). | |
| We're using a script that downloads and builds OpenSSL into fat static libraries for both Mac and iOS. I've put the gist here: | |
| https://gist.github.com/steipete/ce09ba176a4b8ef66b2d/bf053eab1c0f8494dcd3748079543c4ed4367b9c | |
| Enabling Bitcode should be as easy as adding `-fembed-bitcode` as clang flag according to this entry. That's exactly what I did. | |
| Now things build, but the script eventually stops with this error: | |
| ld: could not open bitcode temp file: ../libcrypto.a(aes-x86_64.o) for architecture x86_64 |
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
| #define self \ | |
| ( \ | |
| _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wunused-value\"") self, \ | |
| /* Depends on _cmd being a const copy, like other captured variables. */ \ | |
| _Pragma("clang diagnostic pop") (*(_cmd = _cmd, &self)) \ | |
| ) | |
| // Replace libextobjc's @weakify with one that's aware of the "self" macro. | |
| #undef ext_weakify_ | |
| #define ext_weakify_(INDEX, CONTEXT, VAR) \ |
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 subprocess | |
| def looksLikeBeginning(doc,seg,adr): | |
| if doc.is64Bits() and seg.readByte(adr) == 0x55 and seg.readByte(adr + 1) == 0x48 and seg.readByte(adr + 2) == 0x89 and seg.readByte(adr + 3) == 0xE5: | |
| return True | |
| if not doc.is64Bits() and seg.readByte(adr) == 0x55 and seg.readByte(adr + 1) == 0x89 and seg.readByte(adr + 2) == 0xE5: | |
| return True | |
| return False | |
| doc = Document.getCurrentDocument() |
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 | |
| // All the complexity needed to avoid this code probably isn't worth it in the majority of cases. | |
| // Particularly note that the data model doesn't 100% line up with the JSON (some keys have | |
| // slightly different names for instance). A system flexible enough to handle that (say, something | |
| // like Go's json.Marshal) would be nice, but this code, while slightly tedious, isn't really bad. | |
| // Basically I'm saying that a richer JSON<->Swift system built into stdlib would be nice, but the | |
| // bar is pretty high to go pulling in a helper library. | |
| // | |
| // That said, compare the Go code below, and I think it really is much simpler, and scales much better |
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
| // clang -cc1 -analyzer-checker-help | |
| // OVERVIEW: Clang Static Analyzer Checkers List | |
| // USAGE: -analyzer-checker <CHECKER or PACKAGE,...> | |
| // | |
| // CHECKERS: | |
| // alpha.core.BoolAssignment Warn about assigning non-{0,1} values to Boolean variables | |
| // alpha.core.CallAndMessageUnInitRefArg | |
| // Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers, and pointer to undefined variables) | |
| // alpha.core.CastSize Check when casting a malloc'ed type T, whether the size is a multiple of the size of T | |
| // alpha.core.CastToStruct Check for cast from non-struct pointer to struct pointer |
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
| // Playground - noun: a place where people can play | |
| import Foundation | |
| typealias Byte = UInt8 | |
| protocol GenericIntegerType: IntegerType { | |
| init(_ v: Int) | |
| init(_ v: UInt) | |
| init(_ v: Int8) |
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 | |
| enum CoroutineState { | |
| case Fresh, Running, Blocked, Canceled, Done | |
| } | |
| struct CoroutineCancellation: ErrorType {} | |
| class CoroutineImpl<InputType, YieldType> { | |
| let body: (yield: YieldType throws -> InputType) throws -> Void |
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 | |
| enum FooType: String, Codable { | |
| case bar, baz | |
| } | |
| protocol Foo: AnyObject, Codable { | |
| var type: FooType { get } | |
| } |
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
| // UIImage+Alpha.h | |
| // Created by Trevor Harmon on 9/20/09. | |
| // Free for personal or commercial use, with or without modification. | |
| // No warranty is expressed or implied. | |
| // Helper methods for adding an alpha layer to an image | |
| @interface UIImage (Alpha) | |
| - (BOOL)hasAlpha; | |
| - (UIImage *)imageWithAlpha; | |
| - (UIImage *)transparentBorderImage:(NSUInteger)borderSize; |
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
| // | |
| // CollectionViewDataSource.swift | |
| // Khan Academy | |
| // | |
| // Created by Andy Matuschak on 10/14/14. | |
| // Copyright (c) 2014 Khan Academy. All rights reserved. | |
| // | |
| import UIKit |
OlderNewer