Skip to content

Instantly share code, notes, and snippets.

View bartleby's full-sized avatar
🦄
One More Time

Aleksei Artemev bartleby

🦄
One More Time
View GitHub Profile
@bartleby
bartleby / Published.swift
Last active November 24, 2020 08:58
Published like SwiftUI
//
// ViewController.swift
// Teeeeee
//
// Created by Bartleby Cartman on 23.11.2020.
//
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@bartleby
bartleby / iOS URL Schemes
Created August 22, 2018 17:48
iOS URL Schemes
URL Schemes
Apple
 
Apple Music     — music://geo.itunes.apple.com/us/albums/<albumID>
                – music://geo.itunes.apple.com/us/artists/<artistID>
 
Apple News      — applenews://
App Store       — itms-apps://itunes.apple.com/app/<appID>
Apple TV        — videos://
@bartleby
bartleby / UIViewController+Ext.swift
Last active July 8, 2018 03:09
Get the current visible viewController.
extension UIViewController {
func topMostViewController() -> UIViewController {
if let presented = self.presentedViewController {
return presented.topMostViewController()
}
if let navigation = self as? UINavigationController {
return navigation.visibleViewController?.topMostViewController() ?? navigation
}
open class LinearScale {
var domain: [CGFloat]
var range: [CGFloat]
public init(domain: [CGFloat] = [0, 1], range: [CGFloat] = [0, 1]) {
self.domain = domain
self.range = range
}
@bartleby
bartleby / ProfileView.m
Created January 31, 2015 11:15
Random Image Generator
- (NSArray *)imageURLs
{
if (!_imageURLs)
{
NSMutableArray *imageURLs = [NSMutableArray array];
for (NSInteger index = 0; index < 100; ++index)
{
[imageURLs addObject:[NSString stringWithFormat:
@"http://dummyimage.com/200/%06X/%06X&text=%ld",