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
float frexp(float x, out float e) | |
{ | |
e = ceil(log2(x)); | |
return(x * exp2(-e)); | |
} | |
x = 0.15625; | |
x = -118.62500; | |
v = Ceiling[Log2[Abs[x]]] - 1 |
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
extension String { | |
func htmlAttributedString() -> NSAttributedString? { | |
guard let data = self.data(using: String.Encoding.utf16, allowLossyConversion: false) else { return nil } | |
guard let html = try? NSMutableAttributedString( | |
data: data, | |
options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html], | |
documentAttributes: nil) else { return nil } | |
return html | |
} | |
} |
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
// ©2015 Massimiliano Raber, MIT license | |
// @IBDesignable/@IBInspectable GradientView (linear gradient, 2 stops) | |
import UIKit | |
@IBDesignable | |
class GradientView: UIView { | |
@IBInspectable var startColor: UIColor = UIColor.whiteColor() { | |
didSet { |