Skip to content

Instantly share code, notes, and snippets.

View tularovbeslan's full-sized avatar
:octocat:
Working from home

Beslan Tularov tularovbeslan

:octocat:
Working from home
View GitHub Profile
@tularovbeslan
tularovbeslan / isCyrillic.swift
Created December 4, 2016 21:50
checks for Cyrillic
extension String {
var isCyrillic: Bool {
let chars: Set = ["А","Б","В","Г","Д","Е","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ь","Ю","Я","а","б","в","г","д","е","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ь","ю","я"]
for c in self.characters {
if chars.contains(String(c)) {
return true
}
}
return false
@tularovbeslan
tularovbeslan / json
Created June 28, 2017 14:22
test json
{
"team1_name":"Краснодар",
"team2_name":"Зенит",
"match_id":"578894",
"match_date":"27.11.2016",
"stats":[
{
"maxValue":13720,
"withBar":false,
"paramName":"Total distance",
@tularovbeslan
tularovbeslan / Email and password validate
Created July 9, 2017 19:54
Email and password validate
func isValidEmail(email: String) -> Bool {
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"
let validatedEmail = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return validatedEmail.evaluate(with: email)
}
func isValidPassword(password: String) -> Bool {
let passwordRegEx = "[A-Z0-9a-z]{5,}"
let validatedPassword = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return validatedPassword.evaluate(with: password)
@tularovbeslan
tularovbeslan / UIPageControl dot border
Created August 4, 2017 11:02
UIPageControl dot border
extension UIImage {
class func outlinedEllipse(size: CGSize, color: UIColor, lineWidth: CGFloat = 1.0) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
guard let context = UIGraphicsGetCurrentContext() else {
return nil
}
context.setStrokeColor(color.cgColor)
context.setLineWidth(lineWidth)
@tularovbeslan
tularovbeslan / Hide statusbar.txt
Last active January 24, 2018 11:19
Hide statusbar with slide animation
class ViewController: UIViewController {
var isHidden:Bool = false {
didSet{
UIView.animate(withDuration: 0.5) { () -> Void in
self.setNeedsStatusBarAppearanceUpdate()
}
}
}
override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation{
@tularovbeslan
tularovbeslan / NSDataExtensions.swift
Created July 9, 2018 16:47 — forked from huguesbr/NSDataExtensions.swift
Convert to and from NSData for common Swift types. Includes Eddystone URL conversion.
//
// NSDataExtensions.swift
// MAPO
//
// Created by Hugues Bernet-Rollande on 21/3/16.
// Copyright © 2016 WB Technologies. All rights reserved.
//
import Foundation
localeIdentifier Description
eu Basque
hr_BA Croatian (Bosnia & Herzegovina)
en_CM English (Cameroon)
rw_RW Kinyarwanda (Rwanda)
en_SZ English (Swaziland)
tk_Latn Turkmen (Latin)
he_IL Hebrew (Israel)
ar Arabic
uz_Arab Uzbek (Arabic)
This file has been truncated, but you can view the full file.
[
{
"ISIN": "SP72EL7RYK6UN1G",
"STAT": {
"W": {
"price": [
{
"date": 1547413200000,
"price": 10.35
},
{
"data":[
{
"url":"https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4",
"name":"Bug bunny",
"type":"MP4"
},
{
"url":"https://sample-videos.com/audio/mp3/wave.mp3",
"name":"Noise",
@tularovbeslan
tularovbeslan / SCNText+Typewriter.swift
Created May 25, 2019 18:54
An Example Of Animating SCNText With A Typewriter Like Effect
//1. Timer To Animate Our Text
var animationTimer: Timer?
//2. Variable To Store The Current Time
var time:Int = 0
/// Animates The Presentation Of SCNText To Give An Appearance Of A Typing Effect
///
/// - Parameters:
/// - textGeometry: SCNText