View JSONValue.swift
import Foundation | |
/// A JSONValue is a generic DOM representation of decoded JSON. | |
enum JSONValue { | |
case null | |
case boolean(Bool) | |
case number(Double) | |
case string(String) | |
case array(JSONArray) |
View AllowSelfSignedCertificateRequest.swift
// | |
// Request.swift | |
// TLS-Test | |
// | |
// Created by Nikolai Ruhe on 12.10.18. | |
// Copyright © 2018 Nikolai Ruhe. All rights reserved. | |
// | |
import Foundation |
View AllocatedSizeOfDirectory.swift
// | |
// Copyright (c) 2016, 2018 Nikolai Ruhe. All rights reserved. | |
// | |
import Foundation | |
public extension FileManager { | |
/// Calculate the allocated size of a directory and all its contents on the volume. |
View NRLabel.swift
import UIKit | |
class NRLabel : UILabel { | |
var textInsets: UIEdgeInsets = UIEdgeInsetsZero { | |
didSet { invalidateIntrinsicContentSize() } | |
} | |
override func textRectForBounds(bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect { | |
var rect = textInsets.apply(bounds) |
View NRLabel.swift
import UIKit | |
class NRLabel : UILabel { | |
var textInsets = UIEdgeInsets.zero { | |
didSet { invalidateIntrinsicContentSize() } | |
} | |
override func textRect(forBounds bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect { | |
let insetRect = UIEdgeInsetsInsetRect(bounds, textInsets) |
View NRLabel.m
@interface NRLabel : UILabel | |
@property (nonatomic) UIEdgeInsets textInsets; | |
@end | |
@implementation NRLabel | |
- (void)setTextInsets:(UIEdgeInsets)textInsets | |
{ | |
_textInsets = textInsets; | |
[self invalidateIntrinsicContentSize]; |
View NRLabel
import UIKit | |
class NRLabel : UILabel { | |
var textInsets: UIEdgeInsets = UIEdgeInsetsZero | |
override func textRect(forBounds bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect { | |
let insetRect = UIEdgeInsetsInsetRect(bounds, textInsets) | |
let textRect = super.textRect(forBounds: insetRect, limitedToNumberOfLines: numberOfLines) | |
let invertedInsets = UIEdgeInsets(top: -textInsets.top, |
View CBUUIDrepresentativeString.swift
extension CBUUID { | |
func representativeString() -> String { | |
let data = self.data | |
let buffer = UnsafeBufferPointer<UInt8>(start: UnsafePointer(data.bytes), count: data.length) | |
let hex: (UInt8) -> String = { ($0 <= 9 ? "0" : "") + String($0, radix: 16, uppercase: true) } | |
let dashInserter: (Int) -> String = { [3, 5, 7, 9].contains($0) ? "-" : "" } | |
return buffer.map(hex) | |
.enumerate() |
View gist:07e7d172ca91445e58fc
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta http-equiv="Content-Style-Type" content="text/css"> | |
<meta name="format-detection" content="telephone=no"> | |
<title>Impressum</title> | |
<style type="text/css"> | |
p { margin: 0.0px 0.0px 15.0px 0.0px; font: 12.0pt Helvetica; } | |
</style> |
View gist:e77839f47508f8933df8
<sheet id="main_sheet" meta:month_id="201504" meta:refname="main_sheet"> | |
<section visibility="hidden" meta:timesec.expression="self"> | |
<datefield meta:time="0">1983-11-22T23:00:00Z</datefield> | |
<datefield meta:time="0.25">1983-11-22T23:15:00Z</datefield> | |
<datefield meta:time="0.5">1983-11-22T23:30:00Z</datefield> | |
<datefield meta:time="0.75">1983-11-22T23:45:00Z</datefield> | |
<datefield meta:time="1">1983-11-23T00:00:00Z</datefield> | |
<datefield meta:time="1.25">1983-11-23T00:15:00Z</datefield> | |
<datefield meta:time="1.5">1983-11-23T00:30:00Z</datefield> | |
<datefield meta:time="1.75">1983-11-23T00:45:00Z</datefield> |
NewerOlder