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 BaseVisitor(abc.ABC, Generic[ResultT]): | |
... |
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 ImageDataLoaders(DataLoaders): | |
"Basic wrapper around several `DataLoader`s with factory methods for computer vision problems" | |
@classmethod | |
... |
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 VehicleFlyWeightPattern: | |
“”” flyweight pattern to create lighter than air mass transport objects ””” | |
... |
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
# take from the book Python for DevOps, https://www.amazon.com/Python-DevOps-Ruthlessly-Effective-Automation/dp/149205769X | |
cdp () { | |
dir=$(python3 -c """ | |
from pathlib import Path | |
try: | |
import ${1} as _ | |
print(Path(_.__file__).parent) | |
except Exception as e: | |
print(e) | |
""") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
alias dc='docker container' | |
alias di='docker image' | |
alias dv='docker volume' | |
alias dco='docker-compose' | |
alias gs='git status' | |
alias gd='git diff' | |
alias gds='git diff --staged' | |
alias ga='git add' | |
alias gc='git commit' |
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 func responseArray<T: ResponseJSONObjectSerializable>(completionHandler: Response<[T], NSError> -> Void) -> Self { | |
let serializer = ResponseSerializer<[T], NSError> { request, response, data, error in | |
guard error == nil else { | |
return .Failure(error!) | |
} | |
guard let responseData = data else { | |
let failureReason = "Array could not be serialized because input data was nil." | |
let error = Error.errorWithCode(.DataSerializationFailed, | |
failureReason: failureReason) | |
return .Failure(error) |
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 func responseArray<T: ResponseJSONObjectSerializable>(completionHandler: Response<[T], NSError> -> Void) -> Self { | |
let serializer = ResponseSerializer<[T], NSError> { request, response, data, error in | |
guard error == nil else { | |
return .Failure(error!) | |
} | |
guard let responseData = data else { | |
let failureReason = "Array could not be serialized because input data was nil." | |
let error = Error.errorWithCode(.DataSerializationFailed, | |
failureReason: failureReason) | |
return .Failure(error) |
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 convenience init (_ rgbHex: UInt, alpha: CGFloat = 1.0) { | |
let rawRed = Double((rgbHex & 0xFF0000) >> 16) / 255.0 | |
let rawGreen = Double((rgbHex & 0x00FF00) >> 8 ) / 255.0 | |
let rawBlue = Double((rgbHex & 0x0000FF) ) / 255.0 | |
self.init(red: CGFloat(rawRed), green: CGFloat(rawGreen), blue: CGFloat(rawBlue), alpha: alpha) | |
} |
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 convenience init (_ rgbHex: UInt, alpha: CGFloat = 1.0) { | |
let rawRed = Double((rgbHex >> 16) & 0xFF) / 255.0 | |
let rawGreen = Double((rgbHex >> 8) & 0xFF) / 255.0 | |
let rawBlue = Double(rgbHex & 0xFF) / 255.0 | |
self.init(red: CGFloat(rawRed), green: CGFloat(rawGreen), blue: CGFloat(rawBlue), alpha: alpha) | |
} |