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
/** | |
CoreBluetoothExtensions.swift | |
Easily identify which state a CBCentralManager or CBPeripheralManager is in | |
<https://gist.github.com/tannernelson/f6ba585244afa80b06d2> | |
*/ | |
import CoreBluetooth |
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
/** | |
UIViewExtensions.swift | |
Instantiate a UIView object from a nib in the NSBundle. | |
<https://gist.github.com/tannernelson/4e8e8a31553e46de81fe> | |
*/ | |
import UIKit |
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
/** | |
Converts 16-bit 8:8 Fixed Point numbers to swift Doubles. | |
Fixed Point mathematical functions: | |
<https://courses.cit.cornell.edu/ee476/Math/> | |
Compare the results from these calls to the Examples from the "Fixed Point mathematical functions" paper. | |
Double.from88FixedPoint(0, 0) | |
Double.from88FixedPoint(1, 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
/** | |
NSTimeIntervalExtensions.swift | |
Return human readable string for any NSTimeInterval | |
<https://gist.github.com/tannernelson/e5d2e0bab5a58b938b08> | |
*/ | |
import Foundation |
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
/* | |
UITableViewExtensions.swift | |
Easily animate a UITableView between two data sources. | |
Ensure that the objects in your data source implement the Equatable protocol. | |
This means they must have a declaration `MyClass: Equatable` followed by | |
`public func ==(lhs: MyClass, rhs: MyClass) -> Bool { |
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
public typealias Byte = UInt8 | |
public struct Data { | |
public var bytes: [Byte] | |
public init(_ bytes: [Byte]) { | |
self.bytes = bytes | |
} | |
} |
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 | |
import Vapor | |
/** | |
* This protocol defines router objects that can be used to relay | |
* different paths to the application | |
*/ | |
public protocol RouterDriver { | |
func route(request: Request) -> Request.Handler? |
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 Vapor | |
import Fluent | |
import FluentSQLite | |
let app = Application() | |
do { | |
let driver = try SQLiteDriver(path: "/home/helper/database/test.sqlite") | |
Database.default = Database(driver: driver) | |
} catch { |
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
class BenchmarkController < ActionController::Base | |
def plaintext | |
render plain: "Hello world" | |
end | |
def json | |
a = [1, 2, 3] | |
d = {"one" => 1, "two" => 2, "three" => 3} | |
r = {"array" => a, "dict" => d, "int" => 42, "string" => "test", "double" => 3.14, "null" => nil} |
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
production: | |
<<: *default | |
database: /home/helper/database/test.sqlite |
OlderNewer