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
#limit requests to 3 per second | |
limit_req_zone $binary_remote_addr zone=login:10m rate=3r/s; | |
#https reverse proxy | |
server { | |
listen 443; | |
server_name alpha.brett-toomey.com; | |
ssl_certificate /etc/letsencrypt/live/alpha.brett-toomey.com/cert.pem; | |
ssl_certificate_key /etc/letsencrypt/live/alpha.brett-toomey.com/privkey.pem; |
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 XCTest | |
func expect<E: Error, ReturnType>( | |
toThrow expectedError: E, | |
file: StaticString = #file, | |
line: UInt = #line, | |
from closure: (Void) throws -> ReturnType | |
) where E: Equatable { | |
do { | |
let _ = try closure() |
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 | |
struct User: Model { | |
var id: Node? | |
init(node: Node, in context: Context) throws { | |
id = try node.extract("id") | |
} | |
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 HTTP | |
import Vapor | |
import Fluent | |
import Foundation | |
struct User: Model { | |
var id: Node? | |
var name: String | |
var created_at: Int | |
var updated_at: Int |
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 Foundation | |
struct User: Model { | |
var updated_at: Int | |
//... | |
mutating func save() throws { |
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 | |
struct User: Model { | |
var id: Node? | |
var name: String | |
init(name: String) { | |
self.name = name | |
} |
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/env bash | |
VERSION="3.1" | |
echo "Swift $VERSION Continuous Integration"; | |
# Determine OS | |
UNAME=`uname`; | |
if [[ $UNAME == "Darwin" ]]; | |
then | |
OS="macos"; |
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/env bash | |
VERSION="3.1" | |
echo "Swift $VERSION Continuous Integration"; | |
# Determine OS | |
UNAME=`uname`; | |
if [[ $UNAME == "Darwin" ]]; | |
then | |
OS="macos"; |
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
struct Scanner<Element> { | |
var pointer: UnsafePointer<Element> | |
let endAddress: UnsafePointer<Element> | |
var elements: UnsafeBufferPointer<Element> | |
// assuming you don't mutate no copy _should_ occur | |
let elementsCopy: [Element] | |
} | |
extension Scanner { |
OlderNewer