Skip to content

Instantly share code, notes, and snippets.

View ha1f's full-sized avatar

はるふ ha1f

View GitHub Profile
@ha1f
ha1f / Regex.swift
Last active May 5, 2020 18:36
Swiftで正規表現
//
// Regex.swift
// ha1fRegex
//
// Created by はるふ on 2016/09/30.
// Copyright © 2016年 はるふ. All rights reserved.
//
import Foundation
@ha1f
ha1f / CalendarUtil.swift
Last active January 10, 2017 01:27
カレンダー周り。日本語アプリでも英語表示したい部分もあると思うので
//
// CalendarUtil.swift
// Musubi
//
// Created by はるふ on 2016/10/26.
// Copyright © 2016年 はるふ. All rights reserved.
//
import Foundation
@ha1f
ha1f / ShareActionController.swift
Last active July 4, 2017 07:24
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 July 5, 2017 03:41
Optional.swift
import Foundation
enum Optional<T> {
case none
case some(T)
init() {
self = .none
}
//
// LanguageDetector(Swift3.x).swift
// Musubi
//
// Created by はるふ on 2017/07/12.
// Copyright ©ha1f 2017年 line. All rights reserved.
//
import Foundation
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:
import UIKit
protocol WoExecutable {
func を<Result>(_ process: WoProcess<Self, Result>) -> Result
}
extension WoExecutable {
func を<Result>(_ process: WoProcess<Self, Result>) -> Result {
return process.process(self)
}
//
// PlaceHolderedTextView.swift
// Musubi
//
// Created by はるふ on 2016/11/29.
// Copyright © 2016年 はるふ. All rights reserved.
//
import UIKit
@ha1f
ha1f / randomString.swift
Created September 11, 2017 03:04
randomString
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 }
}
// Disposable
enum Disposables {
static func create() -> Disposable {
NopDisposable()
}
static func create(_ dispose: @escaping () -> Void) -> Disposable {
ClosureDisposable(dispose)
}
}