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
# EvenMinusOdd 偶数引く奇数 | |
# ダイスゲーム百科 P12より | |
# | |
# - 参加人数は何人でも | |
# - 参加人数x10のカウンターを中央に置く | |
# | |
# 手番のプレイヤーは次のことを行う | |
# 1. サイコロを6個ふる | |
# 2. 偶数の目の合計から奇数の目の合計を引いた合計を得点とする | |
# 3. 中央のカウンターから、プレイヤーが得点の数だけとる。マイナスの場合は戻す |
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
// | |
// UIViewController+ScrollWhenShowKeyboard.swift | |
// | |
// | |
import UIKit | |
import RxSwift | |
import RxCocoa | |
extension UIViewController { |
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 Observable { | |
/** | |
example: | |
Observable<String>.of("1", "a", "3", "4") | |
.flatMap { Int($0) } | |
.subscribeNext { print("\($0)") } | |
result: | |
1 | |
3 | |
4 |
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 ObservableType { | |
/** | |
throttleFirst | |
RxJava reference | |
http://reactivex.io/RxJava/javadoc/rx/Observable.html#throttleFirst(long,%20java.util.concurrent.TimeUnit,%20rx.Scheduler) | |
*/ | |
func throttleFirst(time: RxTimeInterval, scheduler: SchedulerType) -> Observable<E> { | |
let s = self.share() |
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 UIKit | |
/** | |
closureでUIViewの初期化処理をあたえられるための拡張 | |
@noescapeをつけているのでclosureの中でselfをつける必要はない | |
ex.) | |
``` | |
override func viewDidLoad() { |
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 UIKit | |
protocol Tappable : class { | |
} | |
extension Tappable where Self : NSObject { | |
func tap(@noescape function: (Self) -> ()) -> Self { | |
function(self) | |
return self |
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 UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
let vc = ViewController() |
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 | |
// "".hexData.hexString // | |
// "01".hexData.hexString // 01 | |
// "ab".hexData.hexString // ab | |
// "abff 99".hexData.hexString // abff99 | |
// "abff\n99".hexData.hexString // abff99 | |
// "abzff 99".hexData.hexString // ab | |
// "abf ff 99".hexData.hexString // ab | |
// "abf".hexData.hexString // ab |
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
// print Apple Device List (https://developer.apple.com/account/ios/device/iphone) on Chrome Developer Console | |
Array.from({length: $("tr").filter((i,o)=>/^[0-9]+$/.test(o.id)).length}, (v, k) => k).forEach(j=>{var i=j+1;setTimeout(()=>{;$("tr#"+i).click()},100*i);setTimeout(()=>{console.log(""+i+",", ["dd.name","dd.model","dd.deviceNumber"].map((s)=>'"'+$('tr#'+i+'+tr').find(s).text()+'"').join())},50+100*i);}) |
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 | |
ComparisonResult.orderedAscending.rawValue // -1 | |
ComparisonResult.orderedSame.rawValue // 0 | |
ComparisonResult.orderedDescending.rawValue // 1 | |
"1.0.0".compare("1.0.1", options: .numeric, range: nil, locale: nil).rawValue // -1 (orderedAscending) | |
"1.0.0".compare("1.0.0", options: .numeric, range: nil, locale: nil).rawValue // 0 (orderedSame) | |
"1.0.0".compare("0.9.9", options: .numeric, range: nil, locale: nil).rawValue // 1 (orderedDescending) |
OlderNewer