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
# Description: | |
# シャッフルランチの管理をします | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
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 | |
extension NSString { | |
func utf16IndexForIndex(index: Int) -> Int { | |
var index = index | |
var result = 0 | |
while result < index { | |
if result + 1 < self.length && | |
CFStringIsSurrogateHighCharacter(self.characterAtIndex(result)) && | |
CFStringIsSurrogateLowCharacter(self.characterAtIndex(result + 1)) { |
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 AVFoundation | |
import RxSwift | |
import RxCocoa | |
extension AVCaptureSession { | |
var rx_runnning: AnyObserver<Bool> { | |
return RxBindingObserver(element: self) { element, value in | |
if value { | |
element.startRunning() |
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 AVFoundation | |
import RxSwift | |
import RxCocoa | |
private let associatedkey = UnsafePointer<Void>(malloc(1)) | |
class RxCaptureMetadataOutputObjectsDelegateProxy: DelegateProxy, DelegateProxyType, AVCaptureMetadataOutputObjectsDelegate { | |
static func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { | |
(object as! AVCaptureMetadataOutput) |
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 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 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 UIVisualEffectView { | |
var effectColor: UIColor? { | |
get { | |
return self.colorEffectView()?.backgroundColor | |
} | |
set { | |
self.colorEffectView()?.backgroundColor = newValue | |
} | |
} | |
private func colorEffectView() -> UIView? { |
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 APIKit | |
import RxSwift | |
extension Session { | |
func rx_sendRequest<T: RequestType>(request: T) -> Observable<T.Response> { | |
return Observable.create { observer in | |
let task = self.sendRequest(request) { result in | |
switch result { | |
case .Success(let res): |
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 <XCTest/XCTest.h> | |
@interface XCTestCase (Private) | |
- (void)_enqueueFailureWithDescription:(id)arg1 inFile:(id)arg2 atLine:(unsigned long long)arg3 expected:(_Bool)arg4; | |
@end | |
@interface UniversalLinksUITests : XCTestCase | |
@property (assign, nonatomic) BOOL ignoreFailure; | |
@end |
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
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 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 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 |
NewerOlder