create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| package com.tomgibara.android.util; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| /** | |
| * A layout that arranges views into a grid of same-sized squares. | 
| First, install nginx for mac with "brew install nginx". | |
| Then follow homebrew's instructions to know where the config file is. | |
| 1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
| 2. Copy it somewhere (use full path in the example below for server.* files) | |
| 3. sudo nginx -s reload | |
| 4. Access https://localhost/ | |
| Edit /usr/local/etc/nginx/nginx.conf: | 
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| Use: for testing against email regex | |
| ref: http://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses | |
| List of Valid Email Addresses | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | 
| extension UIImage { | |
| func cropsToSquare() -> UIImage { | |
| let refWidth = CGFloat(CGImageGetWidth(self.CGImage)) | |
| let refHeight = CGFloat(CGImageGetHeight(self.CGImage)) | |
| let cropSize = refWidth > refHeight ? refHeight : refWidth | |
| let x = (refWidth - cropSize) / 2.0 | |
| let y = (refHeight - cropSize) / 2.0 | |
| let cropRect = CGRectMake(x, y, cropSize, cropSize) | 
| extension String { | |
| func snakeCased() -> String? { | |
| let pattern = "([a-z0-9])([A-Z])" | |
| let regex = try? NSRegularExpression(pattern: pattern, options: []) | |
| let range = NSRange(location: 0, length: self.characters.count) | |
| return regex?.stringByReplacingMatches(in: self, options: [], range: range, withTemplate: "$1_$2").lowercased() | |
| } | |
| } | 
| import UIKit | |
| import AVKit | |
| import AVFoundation | |
| import AssetsLibrary | |
| func synchronized(_ object: AnyObject, block: () -> Void) { | |
| objc_sync_enter(object) | |
| block() | |
| objc_sync_exit(object) | |
| } | 
| enum Foo: String, Codable { | |
| case a | |
| case b | |
| case c | |
| } | |
| extension RawRepresentable where RawValue == String, Self: Codable { | |
| init(from decoder: Decoder) throws { | |
| var container = try decoder.unkeyedContainer() | |
| let rawValue = try container.decode(String.self) | 
| import UIKit | |
| import AVFoundation | |
| class ViewController: UIViewController { | |
| override func viewDidAppear(_ animated: Bool) { | |
| super.viewDidAppear(animated) | |
| switch AVCaptureDevice.authorizationStatus(for: .video) { | |
| case .notDetermined: | 
| // | |
| // Example of Using AVAudioPlayer | |
| // to play a buffer of (synthesized) audio samples from memory | |
| // by converting a [Float] buffer into an in-memory WAV file | |
| // | |
| // Copyright © 2019 Ronald H Nicholson Jr. All rights reserved. | |
| // (re)Distribution permitted under the 3-clause New BSD license. | |
| // | |
| import Foundation |