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
url=https://gist.githubusercontent.com/samdods/1ac451370729c0e9df72cce8bfcaa828/raw/3548420695acec86c721ffa9c74424212dcc2283/impactChecker.swift | |
exe=/tmp/impactChecker`uuidgen` | |
curl -fsSL $url > $exe | |
chmod +x $exe | |
git diff `git merge-base origin/develop HEAD`..HEAD --name-only | $exe | |
rm $exe |
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
url=https://gist.githubusercontent.com/samdods/1ac451370729c0e9df72cce8bfcaa828/raw/3548420695acec86c721ffa9c74424212dcc2283/impactChecker.swift | |
curl -fsSL $url > /tmp/impactChecker | |
chmod +x /tmp/impactChecker |
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/swift | |
import Foundation | |
extension Array where Element == String { | |
func sortedWithPodsLast() -> [String] { | |
self.sorted { lhs, rhs in | |
if lhs.hasPrefix("Pods_") && rhs.hasPrefix("Pods_") { | |
return lhs < rhs |
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
{ | |
"groups": [ | |
{ | |
"name": "reds", | |
"colors": [ | |
{ | |
"name": "red", | |
"hex": "FF0000" | |
}, | |
{ |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
isModalInPresentation = true | |
navigationController?.presentationController?.delegate = self | |
} | |
/// conforming to UIAdaptivePresentationControllerDelegate | |
func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { | |
let controller = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) | |
// ... |
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
final class SelectableLabel: UILabel { | |
// 1... | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
setupTextSelection() | |
} | |
private func setupTextSelection() { |
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
enum Frank { | |
static func start(port: Int = 8080) { | |
// ... steps 1 to 8 from sample code above ... | |
} | |
} | |
typealias ResponseBodyProvider = () -> String | |
private var routedGET: [String: ResponseBodyProvider] = [:] | |
func get(_ path: String, bodyProvider: @escaping ResponseBodyProvider) { |
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
get("/home") { | |
return "🏠" | |
} | |
get("/people") { | |
return """ | |
<html><head><style> | |
h1 { font-size:4cm; text-align: center } | |
</style></head> | |
<body><h1>👫👫👫👫👫</h1></body> |
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
while(true) { | |
// 5: Wait for a request | |
let fd = accept(sock, nil, nil) | |
print("Connection made") | |
guard fd >= 0 else { | |
print("Can't accept connection") |
NewerOlder