- Swift
- Objective-C
- C++/C
- JavaScript
- Mac OSX
- iOS
#!/bin/bash | |
ADB_PATH="/Users/lee/Library/Android/sdk/platform-tools" | |
PACKAGE_NAME="com.yourcompany.app" | |
DB_NAME="default.realm" | |
DESTINATION_PATH="/Users/lee/Downloads/${DB_NAME}" | |
NOT_PRESENT="List of devices attached" | |
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'` | |
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then | |
echo "Make sure a device is connected" | |
else |
When you get an error code in with the domain kCFStreamErrorDomainSSL, you can generally find the error codes in SecureTransport.h which is in /System/Library/Frameworks/Security.framework. Here are the error codes: | |
enum { | |
errSSLProtocol = -9800, /* SSL protocol error */ | |
errSSLNegotiation = -9801, /* Cipher Suite negotiation failure */ | |
errSSLFatalAlert = -9802, /* Fatal alert */ | |
errSSLWouldBlock = -9803, /* I/O would block (not fatal) */ | |
errSSLSessionNotFound = -9804, /* attempt to restore an unknown session */ | |
errSSLClosedGraceful = -9805, /* connection closed gracefully */ | |
errSSLClosedAbort = -9806, /* connection closed via error */ |
extension String { | |
func size(withAttributes attrs: [String:AnyObject], constrainedTo box: NSSize) -> NSRect { | |
let storage = NSTextStorage(string: self) | |
let container = NSTextContainer(containerSize: NSSize(width: box.width, height: box.height)) | |
let layout = NSLayoutManager() | |
layout.addTextContainer(container) | |
storage.addLayoutManager(layout) | |
storage.addAttributes(attrs, range: NSMakeRange(0, storage.length)) | |
container.lineFragmentPadding = 0.0 | |
let _ = layout.glyphRangeForTextContainer(container) |
#!/bin/bash | |
#=============================================================================== | |
# Filename: build_gmp.sh | |
# Created by Volodymyr Boichentsov on 18/09/2015. | |
# Copyright © 2015 3D4Medical. All rights reserved. | |
# Property of 3D4Medical. | |
#=============================================================================== | |
#-emit-obj -fembed-bitcode -disable-llvm-optzns -O3 |
// Note: This must be used in an Xcode project that contains a bridging header | |
// that includes <asl.h> | |
import Foundation | |
/// Provides high-level methods to access the raw data in | |
/// an ASL message. | |
struct SystemLogEntry { | |
/// Key-value pairs read from ASL message | |
let data: [String : String] |
// 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 ensures that the automaticallyAdjustsScrollViewInsets magic works | |
// On our newly added view controller as well. | |
// This triggers _layoutViewController which then triggers | |
// _computeAndApplyScrollContentInsetDeltaForViewController: | |
// which finally updates our content inset of the scroll view (if any) | |
// rdar://19053416 | |
[self.navigationController.view setNeedsLayout]; |
To remove a submodule you need to: