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
root@743f9944e259:/VaporTest# /usr/bin/swift-build-tool -f /VaporTest/.build/debug.yaml -v | |
/usr/bin/swiftc -target armv7-unknown-linux-gnueabihf -sdk / -g -L /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug -o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/Run -module-name Run -emit-executable -Xlinker '-rpath=$ORIGIN' /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/app.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/boot.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/configure.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/Controllers/TodoController.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/Models/Todo.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/Routes.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/Async.build/Async+NIO.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/Async.build/AsyncError.swift.o /VaporTest/.build/armv7-u |
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
let pointSize: CGFloat = 60 | |
let systemFontDesc = UIFont.systemFont(ofSize: pointSize, weight: UIFont.Weight.light).fontDescriptor | |
let smallCapsFontDesc = systemFontDesc.addingAttributes( | |
[ | |
UIFontDescriptor.AttributeName.featureSettings: | |
[ | |
[ | |
kCTFontFeatureTypeIdentifierKey: kLowerCaseType, | |
kCTFontFeatureSelectorIdentifierKey: kLowerCaseSmallCapsSelector | |
] |
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 PdfFile { | |
var filepath: String? | |
var file: PDFDocument? | |
private var cacheImages = NSCache<NSString, UIImage>() | |
var numberOfPages: Int { | |
return file?.pdfDocument?.numberOfPages ?? 0 | |
} | |
init(filepath path: String?) { |
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 Apollo | |
let path = NSSearchPathForDirectoriesInDomains( .documentDirectory, .userDomainMask, true).first! | |
let url = URL(string: "http://localhost:3000/graphql")! | |
let cache = try! SQLiteNormalizedCache(fileURL: URL(string: "\(path)/db.sqlite3")!) | |
let apollo = ApolloClient(networkTransport: HTTPNetworkTransport(url: url), store: ApolloStore(cache: cache)) | |
apollo.fetch(query: AllReceiptsQuery()){ (result, error) in | |
print(result?.data?.receipts?.first) | |
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
Observable<Int>.interval(1, scheduler: ConcurrentDispatchQueueScheduler.init(qos: DispatchQoS.background)).subscribe { _ in | |
URLSession.shared.rx.json(url: url).subscribe(onNext: { json in | |
print(json) | |
}) | |
} |
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
@implementation TryCatch | |
+ (void)try:(void(^_Nonnull)())try | |
catch:(nullable void(^)(NSException* _Nullable exception))catch | |
finally:(nullable void(^)())finally { | |
@try { | |
try ? try() : nil; | |
} | |
@catch (NSException *exception) { |
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
@implementation UIImageView (Asynchronous) | |
+ (instancetype _Nonnull)imageViewWithURL:(NSString * _Nonnull )url { | |
return [self imageViewWithURL:url completionHandler:nil]; | |
} | |
+ (instancetype _Nonnull)imageViewWithURL:(NSString * _Nonnull )url | |
completionHandler:(completionHandler _Nullable)block { | |
UIImageView *imageView = [UIImageView new]; | |
[imageView loadImageWithURL:url completionHandler:block]; |
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
@implementation UIImage (AverageColor) | |
- (UIColor * _Nonnull)averageColor { | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
unsigned char rgba[4]; | |
CGContextRef context = CGBitmapContextCreate(rgba, 1, 1, 8, 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); | |
CGContextDrawImage(context, CGRectMake(0, 0, 1, 1), self.CGImage); | |
CGColorSpaceRelease(colorSpace); | |
CGContextRelease(context); |
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
git rebase -i [COMMIT BEFORE THE FIRST YOU WANT TO EDIT] | |
# Mark all messages to be changed with "edit". | |
# Git will start the rebasing and stop at every marked commit. | |
git commit -amend -m "new message" | |
git rebase -continue |
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 Array2D<T> { | |
let columns: Int | |
let rows: Int | |
var array: Array<T?> | |
init(columns: Int, rows: Int) { | |
self.columns = columns | |
self.rows = rows | |
array = Array<T?>(count: rows * columns, repeatedValue: nil) | |
} |