View shuffle_lunch.coffee
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
# Description: | |
# シャッフルランチの管理をします | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
View NSString+Surrogate.swift
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 | |
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)) { |
View AVCaptureSession+Rx.swift
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() |
View RxCaptureMetadataOutputObjectsDelegateProxy.swift
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 | |
private let associatedkey = UnsafePointer<Void>(malloc(1)) | |
class RxCaptureMetadataOutputObjectsDelegateProxy: DelegateProxy, DelegateProxyType, AVCaptureMetadataOutputObjectsDelegate { | |
static func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { | |
(object as! AVCaptureMetadataOutput) |
View APIKit+Himotoki.swift
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) | |
} | |
} |
View UIVisualEffectView+EffectColor.swift
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? { |
View APIKit+Rx.swift
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 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): |
View UniversalLinksUITests.m
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 <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 |
View gist:acc59af0e04bf31188dc
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 |
View gist:fe383dce2c8be3c8ac3c
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 |
NewerOlder