Skip to content

Instantly share code, notes, and snippets.

View alexbaramilis's full-sized avatar

Alexandros Baramilis alexbaramilis

View GitHub Profile
@alexbaramilis
alexbaramilis / kaggle.txt
Last active October 23, 2023 12:24
Predicting gender from human hand x-rays (Part 1)
https://www.kaggle.com/code/alexbaramilis/predicting-gender-from-human-hand-x-rays-part-1
void refresh() {
futureMostRecentTrade =
loopringService.getMostRecentTrade(tradingPair: selectedTradingPair);
futureCandlestickSeries =
loopringService.getCandlestickData(tradingPair: selectedTradingPair);
}
@alexbaramilis
alexbaramilis / PropellerForecastResponse.swift
Created May 8, 2019 11:11
Air by Propeller's API forecast response with Decodable and CodingKeys
struct PropellerForecastResponse: Decodable {
let properties: PropellerForecastProperties
}
struct PropellerForecastProperties: Decodable {
let risk: String // risk of adverse respiratory conditions: "high", "medium" or "low"
let probability: Double // probability of adverse respiratory conditions: ex. 0.4938...
}
// MARK: - CodingKeys
@alexbaramilis
alexbaramilis / AirVisualNearestCityResponseCodingKeys.swift
Last active May 8, 2019 11:08
AirVisual API's nearest_city endpoint response CodingKeys extensions
// MARK: - CodingKeys
extension AirVisualNearestCityData {
enum CodingKeys: String, CodingKey {
case city = "city"
case currentConditions = "current"
}
}
extension AirVisualWeather {
@alexbaramilis
alexbaramilis / AirVisualNearestCityResponse.swift
Created May 8, 2019 10:24
AirVisual API's nearest_city endpoint response struct with Decodable
struct AirVisualNearestCityResponse: Decodable {
let status: String
let data: AirVisualNearestCityData
}
struct AirVisualNearestCityData: Decodable {
let city: String
let currentConditions: AirVisualCurrentConditions
}
@alexbaramilis
alexbaramilis / PropellerAPI.swift
Created May 4, 2019 11:17
Air by Propeller API with Moya.
import Foundation
import Moya
enum PropellerAPI {
case forecast(lat: Double, lon: Double)
}
extension PropellerAPI: TargetType {
var baseURL: URL {
return URL(string: "https://open.propellerhealth.com/prod")!
@alexbaramilis
alexbaramilis / AirVisualAPI.swift
Last active May 4, 2019 11:13
AirVisual API with Moya.
import Foundation
import Moya
enum AirVisualAPI {
static private let key = "A5xEAXuhEFJZyZA4o"
case nearestCity(lat: Double, lon: Double)
}
extension AirVisualAPI: TargetType {
@alexbaramilis
alexbaramilis / BreatherMainViewModel.swift
Created April 24, 2019 15:25
Breather MainViewModel
import Foundation
import UIKit.UIImage
import UIKit.UIColor
import RxSwift
import RxCocoa
class MainViewModel: ViewModel {
// MARK: - Inputs
@alexbaramilis
alexbaramilis / BindingTheViewModelInBreather.swift
Last active April 24, 2019 14:50
Binding the view model in Breather.
// MARK: - Private Properties
private let refreshSubject = PublishSubject<Void>()
private let disposeBag = DisposeBag()
// MARK: - Methods
private func bindViewModel() {
// Inputs
refreshSubject
@alexbaramilis
alexbaramilis / SettingAttributedTextWithSubscripts.swift
Last active April 16, 2019 15:21
Using setAttributedTextWithSubscripts extension on UILabel.
let text = "Main pollutant: \(Text.forMainPollutant(data.pollution.mainPollutantUS))"
mainPollutantLabel.setAttributedTextWithSubscripts(text: text,
indicesOfSubscripts: text.indicesOfNumbers)