Skip to content

Instantly share code, notes, and snippets.

Avatar

はるふ ha1f

View GitHub Profile
@ha1f
ha1f / Regex.swift
Last active May 5, 2020
Swiftで正規表現
View Regex.swift
//
// Regex.swift
// ha1fRegex
//
// Created by はるふ on 2016/09/30.
// Copyright © 2016年 はるふ. All rights reserved.
//
import Foundation
@ha1f
ha1f / CalendarUtil.swift
Last active Jan 10, 2017
カレンダー周り。日本語アプリでも英語表示したい部分もあると思うので
View CalendarUtil.swift
//
// CalendarUtil.swift
// Musubi
//
// Created by はるふ on 2016/10/26.
// Copyright © 2016年 はるふ. All rights reserved.
//
import Foundation
@ha1f
ha1f / ShareActionController.swift
Last active Jul 4, 2017
ShareActionController.swift
View ShareActionController.swift
//
// ShareActionController.swift
// Musubi
//
// Created by はるふ on 2017/07/04.
// Copyright © 2017年 はるふ. All rights reserved.
//
import UIKit
import SafariServices
@ha1f
ha1f / Optional.swift
Last active Jul 5, 2017
Optional.swift
View Optional.swift
import Foundation
enum Optional<T> {
case none
case some(T)
init() {
self = .none
}
View LanguageDetector.swift
//
// LanguageDetector(Swift3.x).swift
// Musubi
//
// Created by はるふ on 2017/07/12.
// Copyright ©ha1f 2017年 line. All rights reserved.
//
import Foundation
View LICENCE
MIT License
Copyright (c) 2017 はるふ(ha1f)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View WoExecutable.swift
import UIKit
protocol WoExecutable {
func <Result>(_ process: WoProcess<Self, Result>) -> Result
}
extension WoExecutable {
func <Result>(_ process: WoProcess<Self, Result>) -> Result {
return process.process(self)
}
View PlaceHolderedTextView.swift
//
// PlaceHolderedTextView.swift
// Musubi
//
// Created by はるふ on 2016/11/29.
// Copyright © 2016年 はるふ. All rights reserved.
//
import UIKit
View randomString.swift
import Foundation
import UIKit
private func arrayBetween(_ c1: String, _ c2: String) -> [UInt32] {
guard let s1 = c1.unicodeScalars.first?.value,
let s2 = c2.unicodeScalars.first?.value else {
return []
}
return (s1 < s2 ? (s1...s2) : (s2...s1)).map { $0 }
}
View Observable.swift
// Disposable
enum Disposables {
static func create() -> Disposable {
NopDisposable()
}
static func create(_ dispose: @escaping () -> Void) -> Disposable {
ClosureDisposable(dispose)
}
}