This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension SocketClient { | |
enum Event: String, CaseIterable { | |
// Chat: | |
case sendMessage = "speak" | |
case typing = "typing" | |
case lastSeen = "last_seen" | |
case unreadConversations = "unread_conversations" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// The WeakSet is weak: References to objects in the collection are held weakly. | |
/// If there is no other reference to an object stored in the WeakSet, they can be garbage collected. | |
public class WeakSet<T>: Sequence, ExpressibleByArrayLiteral, CustomStringConvertible, CustomDebugStringConvertible { | |
private var objects = NSHashTable<AnyObject>.weakObjects() | |
public init(_ objects: [T]) { | |
for object in objects { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
// MARK: - Localized | |
public protocol Localized { | |
var localized: String { get } | |
} | |
extension String: Localized { | |
public var localized: String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2 | |
$tar xvf protobuf-2.5.0.tar.bz2 | |
$cd protobuf-2.5.0 | |
$./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi" | |
$make -j 4 | |
$sudo make install | |
$protoc --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AsynchronousBlockOperation.swift | |
// | |
// Created by Jose Canepa on 12/13/17. | |
// Copyright © 2017 Jose Canepa. All rights reserved. | |
// | |
import Foundation | |
/// Block based version of the AsynchronousOperation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
/// ShowTime displays your taps and swipes when you're presenting or demoing. | |
/// Change the options to customise ShowTime. | |
public final class ShowTime: NSObject { | |
/// Defines if and when ShowTime should be enabled. | |
/// | |
/// - always: ShowTime is always enabled. | |
/// - never: ShowTime is never enabled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIDevice { | |
/** | |
Returns device ip address. Nil if connected via celluar. | |
*/ | |
func getIP() -> String? { | |
var address: String? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original video tutorial | |
// https://www.youtube.com/watch?v=6iSuc2vxT8g | |
// 0. Install a Homebrew | |
// https://brew.sh/ | |
// 1. Install Ruby to your Mac | |
// brew install ruby | |
// 2. Install aria2 tool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Alamofire | |
import Foundation | |
final class CustomAlamofireManager: Alamofire.SessionManager { | |
private static let requestTimeOutTimeInterval: TimeInterval = { | |
#if DEBUG | |
return 30.0 | |
#else | |
return 120.0 |