Skip to content

Instantly share code, notes, and snippets.

// Yandex Channels List
https://tv.yandex.ru/ajax?params=%5B%7B%22name%22%3A%22i-tv-region%22%2C%22method%22%3A%22get%22%2C%22args%22%3A%7B%22params%22%3A%22%7B%5C%22type%5C%22%3A%5C%22regional%5C%22%2C%5C%22packageIds%5C%22%3A%5B%5D%2C%5C%22limit%5C%22%3A500%2C%5C%22fields%5C%22%3A%5C%22schedules%2Cchannels%2Cfinish%2Cchannel%2Cid%2Ctitle%2Cfavourite%5C%22%2C%5C%22lang%5C%22%3A%5C%22ru%5C%22%7D%22%2C%22cacheKey%22%3A%22channels%3Fparams%3D%7B%5C%22type%5C%22%3A%5C%22regional%5C%22%2C%5C%22packageIds%5C%22%3A%5B%5D%2C%5C%22limit%5C%22%3A500%2C%5C%22fields%5C%22%3A%5B%5C%22schedules%5C%22%2C%5C%22channels%5C%22%2C%5C%22finish%5C%22%2C%5C%22channel%5C%22%2C%5C%22id%5C%22%2C%5C%22title%5C%22%2C%5C%22favourite%5C%22%5D%7D%22%2C%22userRegion%22%3A%22213%22%2C%22resource%22%3A%22channels%22%2C%22ncrd%22%3A1469479392374%7D%7D%2C%7B%22name%22%3A%22i-tv-region%22%2C%22method%22%3A%22get%22%2C%22args%22%3A%7B%22params%22%3A%22%7B%5C%22type%5C%22%3A%5C%22local%5C%22%2C%5C%22packageIds%5C%22%3A%5B%5D%2C%5C%22limit%5C%22%
**------------------------------------------------------------------------------------------------
* @header_start
* WebGrab+Plus ini for grabbing EPG data from TvGuide websites
* @Site: tv.yandex.ru
* @MinSWversion: V1.1.1/56.27
* @Revision 2 - [28/07/2016] Blackbear199
* - title match fix
* @Revision 1 - [25/07/2016] Blackbear199
* - added subtitle
* - added country
//
// Spinner.swift
//
// Created by Michał Majchrzycki on 28.03.2018.
// Copyright © 2018 Prograils.com. All rights reserved.
// Check whole tutorial at: https://prograils.com/posts/reusable-activity-indicator-with-swift
import UIKit
open class Spinner {
@konnnn
konnnn / AVPlayer+IsPlaying.swift
Created April 21, 2019 12:22
Check if AVPlayer is currently playing an item
import Foundation
import AVFoundation
extension AVPlayer {
var isPlaying: Bool {
return (self.player.rate != 0 && self.player.error == nil)
}
}
@konnnn
konnnn / UILabel+Padding.swift
Last active February 22, 2024 13:24
Swift 4: Adding space/padding to a UILabel Programmatically and Storyboard
/*
If you use Storyboard, don't forget to set UIlabel to PaddingLabel
*/
import UIKit
class PaddingLabel: UILabel {
var topInset: CGFloat
var bottomInset: CGFloat
// UITextField+CharactersLimit.swift
// https://gist.github.com/konnnn/0caf0f08c2c800cf409aecac14f04c18
import UIKit
// Limit = 15 characters
extension TextField: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
guard let text = textField.text else { return true }
let newLength = text.count + string.count - range.length
// Created by Evgeny Konkin on 17.06.2019.
extension UIColor {
static let themeExample = { () -> UIColor in
let color = UIColor(hexString: "#7C7C7C")
return color
}()
static let wGray = UIColor(hexString: "#7C7C7C")
// Created by Evgeny Konkin on 17.06.2019.
extension UIFont {
class func customRegularFont(size: CGFloat) -> UIFont {
return UIFont(name: "FontName", size: size) ?? UIFont.systemFont(ofSize: size, weight: UIFont.Weight.regular)
}
}
// Created by Evgeny Konkin on 17.06.2019.
// Liner Gradient
extension UIView {
func addGradientToView() {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = self.bounds
self.layer.insertSublayer(gradientLayer, at: 0)
gradientLayer.locations = [0.0, 0.4, 1.0]
gradientLayer.colors = [
// Created by Evgeny Konkin on 17.06.2019.
extension UIImage {
/// Resize image to new size ::byKonnn
func resizeImage(to newImageSize: CGSize) -> UIImage {
// Guard newSize is different
guard self.size != newImageSize else { return self }
let widthRatio = newImageSize.width / self.size.width
let heightRatio = newImageSize.height / self.size.height