- с утра посвизлил - весь день свободен
- украл, посвиззлил - в тюрьму
- волков бояться - в лесу не свиззлить
- не все золото что свиззлит
- свиззлинг - всему голова
- и рыбку съесть, и посвиззлить
- в большой семье свиззлом не щелкают
// | |
// Storage.swift | |
// | |
// Created by Grigory Avdyushin on 30.06.16. | |
// Copyright © 2016 Grigory Avdyushin. All rights reserved. | |
// | |
import UIKit | |
import CoreData |
import Foundation | |
// Compressing and decompressing a UUID to 22 characters via base64. | |
// Works great as a Swift playground. These articles were helpful: | |
// http://blog.codinghorror.com/equipping-our-ascii-armor/ | |
// http://69.195.124.60/~jasondoh/2013/08/14/creating-a-short-guid-in-objective-c/ | |
let identifier = NSUUID().uuidString | |
let base64TailBuffer = "=" |
UIFont: family Thonburi | |
UIFont: font Thonburi-Bold | |
UIFont: font Thonburi | |
UIFont: font Thonburi-Light | |
UIFont: family Khmer Sangam MN | |
UIFont: font KhmerSangamMN | |
UIFont: family Snell Roundhand | |
UIFont: font SnellRoundhand-Black | |
UIFont: font SnellRoundhand-Bold | |
UIFont: font SnellRoundhand |
import CoreGraphics | |
import Foundation | |
import UIKit | |
class GradientLabel : UILabel { | |
let gradient: CGGradient! | |
let alignedToSuperview: Bool! |
func setupGradientBackground() { | |
let firstColor = UIColor.black.withAlphaComponent(0.6) | |
let secondColor = UIColor.black.withAlphaComponent(0.0) | |
let gradient = CGGradient.with(easing: Cubic.EaseIn, between: firstColor, and: secondColor) | |
var updatedSize = self.navigationBar.bounds.size | |
updatedSize.height += 20 | |
UIGraphicsBeginImageContextWithOptions(updatedSize, false, 0); |
Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect to it.
If only there was a way to get your work computer to 'share' it's network, so that you could get at that VM… Here's how you do it!
For all instructions, I assume your work computer is a mac
@objc public enum AppContextError: Int, CustomStringConvertible, CustomNSError, LocalizedError { | |
case badParameters | |
case unknownError | |
case connectNotSupported | |
public static var errorDomain: String { | |
return "AppContextError" | |
} |
NSManagedObjectContext *context = object.managedObjectContext; | |
while (context != nil) { | |
NSError *error = nil; | |
BOOL result = [context save:&error]; | |
NSAssert(result != NO, @"[ERROR]: Context was not saved"); | |
if (result) { | |
context = context.parentContext; | |
} else { |
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |