This file contains 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
sudo xcrun xcscontrol --reset |
This file contains 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
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'colorize' | |
require 'erubis' | |
class Manager | |
class SwiftConverter | |
def to_swift | |
raise 'Error: method `to_swift` is not implemented' |
This file contains 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 NSUUID { | |
class func timeBasedUUID() -> NSUUID { | |
let uuidSize = sizeof(uuid_t) | |
let uuidPointer = UnsafeMutablePointer<UInt8>.alloc(uuidSize) | |
uuid_generate_time(uuidPointer) | |
let uuid = NSUUID(UUIDBytes: uuidPointer) | |
uuidPointer.dealloc(uuidSize) | |
return uuid | |
} | |
} |
This file contains 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
struct Person { | |
let name: String | |
func isValid() -> Bool { | |
return !name.characters.isEmpty | |
} | |
} | |
let validPerson = Person(name: "Tom") | |
let invalidPerson = Person(name: "") |
This file contains 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
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool { | |
guard let url = request.URL else { | |
return true | |
} | |
if url.scheme.rangeOfString("^https?", options: .RegularExpressionSearch) != nil { | |
return true | |
} | |
if !UIApplication.sharedApplication().canOpenURL(url) { | |
// iOS9でInfo.plistに登録してないとfalseになるのでここに来る | |
return false |
This file contains 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 String { | |
func isValidMyNumber() -> Bool { | |
enum Error: ErrorType { | |
case NonNumber | |
} | |
let numbers: [Int] | |
do { | |
numbers = try self.characters.map { (char) -> Int in | |
guard let value = Int(String(char)) else { | |
throw Error.NonNumber |
This file contains 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 UIVisualEffectView { | |
var effectColor: UIColor? { | |
get { | |
return self.colorEffectView()?.backgroundColor | |
} | |
set { | |
self.colorEffectView()?.backgroundColor = newValue | |
} | |
} | |
private func colorEffectView() -> UIView? { |
This file contains 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
#!/usr/bin/env ruby | |
require 'xcodeproj' | |
require 'colorize' | |
Dir.chdir "#{__dir__}/../" | |
class LibraryUpdateManager | |
attr_accessor :update_carthage, :update_cocoapods, :acknowledgements_path | |
def initialize |
This file contains 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 APIKit | |
import Himotoki | |
extension RequestType where Response: Decodable, Response.DecodedType == Response { | |
func responseFromObject(object: AnyObject, URLResponse: NSHTTPURLResponse) -> Response? { | |
return try? decode(object) | |
} | |
} |
This file contains 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 AVFoundation | |
import RxSwift | |
import RxCocoa | |
extension AVCaptureSession { | |
var rx_runnning: AnyObserver<Bool> { | |
return RxBindingObserver(element: self) { element, value in | |
if value { | |
element.startRunning() |
OlderNewer