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 Kingfisher | |
import CoreImage | |
private let colorCubeData: [Float] = [ | |
0, 0, 0, 1, | |
1, 0, 0, 1, | |
0, 1, 0, 1, | |
1, 1, 0, 1, | |
0, 0, 1, 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
for file in *.png | |
do | |
name=$(echo ${file%_*.png} | tr '[:upper:]' '[:lower:]' | tr ' ' '_') | |
tmp=${file##*_} | |
res=${tmp%.png} | |
mkdir -p drawable-$res | |
echo $file "->" drawable-$res/$name.png | |
mv "$file" "drawable-$res/$name.png" | |
done |
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
// ==UserScript== | |
// @name Revert GitHub theme | |
// @namespace https://github.com | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author vzsg | |
// @match https://*.github.com/* | |
// @grant none | |
// ==/UserScript== |
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 Config { | |
public func setup() throws { | |
// ... | |
addConfigurable(middleware: Html5RoutingMiddleware.init, name: "html5") | |
} | |
// ... | |
} |
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 RSAKey { | |
init?(pem: String) { | |
let bio = BIO_new(BIO_s_mem()) | |
defer { | |
BIO_free(bio) | |
} | |
_ = pem.withCString { key in | |
BIO_puts(bio, key) | |
} |
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 Alamofire | |
import RxSwift | |
extension Reactive where Base: SessionManager { | |
func encodeMultipartUpload(to url: URLConvertible, method: HTTPMethod = .post, headers: HTTPHeaders = [:], data: @escaping (MultipartFormData) -> Void) -> Observable<UploadRequest> { | |
return Observable.create { observer in | |
self.base.upload(multipartFormData: data, | |
to: url, | |
method: method, |
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 CTLS | |
import JWT | |
extension RSAKey { | |
init?(cert: String) { | |
let bio = BIO_new(BIO_s_mem()) | |
defer { | |
BIO_free(bio) | |
} |
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 FluentProvider | |
extension Config { | |
public func setup() throws { | |
// ... | |
addConfigurable(command: DailyCommand.init, name: "daily") | |
} | |
// ... | |
} |
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 | |
struct MagicTestRequest: Codable { | |
let tokens: [String] | |
} | |
struct MagicTestResponse: Codable { | |
let count: 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 Foundation | |
// A simple protocol that describes the services available on the external service | |
// FIXME: Beer is an immutable, Codable struct defined elsewhere, not important now | |
public protocol BreweryDatabase { | |
func search(_ query: String) throws -> [Beer] | |
func findBeer(id: String) throws -> Beer | |
} |
OlderNewer