Skip to content

Instantly share code, notes, and snippets.

View kot331107's full-sized avatar
🏈

Philipp Mikheyev kot331107

🏈
View GitHub Profile
@kot331107
kot331107 / total_days_between_dates.swift
Last active June 6, 2022 11:10
Swift: get total days of DateComponents with a fractional part (including hours, minutes, etc)
//
// main.swift
// swift challenges
//
// Created by Filipp Mikheev on 06.06.22.
//
import Foundation
extension DateComponents {
@kot331107
kot331107 / prime_numbers.swift
Created June 6, 2022 11:09
gets first N prime numbers
//
// main.swift
// swift challenges
//
// Created by Filipp Mikheev on 06.06.22.
//
import Foundation
func getFirstPrimeNumbers(lastNumber: Int) -> [Int] {
@kot331107
kot331107 / measure_time.swift
Created June 6, 2022 11:18
simple function to measure time of execution of anything. it's pretty enough to measure some simple things.
//
// main.swift
// swift challenges
//
// Created by Filipp Mikheev on 06.06.22.
//
func measureTime(block : (() -> Void)) {
let start = DispatchTime.now()
block()
@kot331107
kot331107 / DictionaryToJSON.swift
Created July 10, 2022 22:08
converts dictionary to JSON
//
// main.swift
// swift challenges
//
// Created by Filipp Mikheev on 11.07.22.
//
import Foundation
extension Dictionary where Key == String, Value == Any {