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
#!/usr/bin/ruby | |
=begin | |
Usage: rtftomarkdown.rb FILENAME.rtf | |
Uses textutil, available on Mac only (installed by default) | |
Outputs to STDOUT | |
Notes: | |
Links are replaced with Markdown references (duplicate links combined). |
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 Darwin | |
let isLittleEndian = Int(OSHostByteOrder()) == OSLittleEndian | |
let htons = isLittleEndian ? _OSSwapInt16 : { $0 } | |
let htonl = isLittleEndian ? _OSSwapInt32 : { $0 } | |
let htonll = isLittleEndian ? _OSSwapInt64 : { $0 } | |
let ntohs = isLittleEndian ? _OSSwapInt16 : { $0 } | |
let ntohl = isLittleEndian ? _OSSwapInt32 : { $0 } | |
let ntohll = isLittleEndian ? _OSSwapInt64 : { $0 } |
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 | |
// MARK: - Comparable | |
extension NSDecimalNumber: Comparable {} | |
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool { | |
return lhs.compare(rhs) == .OrderedSame | |
} |