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 String { | |
var date: Date { | |
let formatter = DateFormatter() | |
formatter.timeZone = TimeZone(secondsFromGMT: 0) | |
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | |
guard let date = formatter.date(from: self) else { | |
fatalError("Cannot build a date from \(self) 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
class YearsBetweenDatesBehavior: | |
Behavior<YearsBetweenDatesBehavior.Context> { | |
struct Context { | |
let sut: (Calendar) -> (Date, Date) -> Int? | |
let from: String | |
let to: String | |
let calendar: Calendar.Identifier | |
let expected: 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
// See article at: https://jakubturek.com/separating-decisions-and-effects/ | |
import Foundation | |
import Quick | |
import Nimble | |
// MARK: - Data models | |
struct UserToken: Codable { | |
let token: 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
// See article at: https://jakubturek.com/separating-decisions-and-effects/ | |
import Foundation | |
import Quick | |
import Nimble | |
// MARK: - Data models | |
struct UserToken: Codable { | |
let token: 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 org.opencv.core.Core | |
import org.opencv.core.Mat | |
import org.opencv.core.MatOfByte | |
import org.opencv.core.Size | |
import org.opencv.imgcodecs.Imgcodecs | |
import org.opencv.imgproc.Imgproc | |
import org.opencv.videoio.VideoCapture | |
import java.awt.Dimension | |
import java.awt.FlowLayout | |
import java.io.ByteArrayInputStream |
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
def find_duplicates | |
`jscpd` | |
unless File.exists?('jscpd_report.json') | |
puts "jscpd_report.json was not generated..." | |
return | |
end | |
jscpd_report = JSON.parse(File.read('jscpd_report.json')) | |
jscpd_clones = jscpd_report["statistics"]["clones"] |