Skip to content

Instantly share code, notes, and snippets.

Avatar

はるふ ha1f

View GitHub Profile
@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 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 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 LanguageDetector.swift
//
// LanguageDetector(Swift3.x).swift
// Musubi
//
// Created by はるふ on 2017/07/12.
// Copyright ©ha1f 2017年 line. All rights reserved.
//
import Foundation
View Rgba.swift
//
// Rgba.swift
// ha1f-chat
//
// Created by ST20591 on 2017/07/19.
// Copyright © 2017年 ha1f. All rights reserved.
//
import UIKit
View Dictionary+Extension.swift
extension Dictionary {
func duplicated() -> Dictionary<Key, Value> {
return reduce(into: [Key: Value]()) { (dict, item) in
dict[item.key] = item.value
}
}
}
View UIViewController+Extension.swift
extension UIViewController {
private class ExtendedBottomView: UIView { }
/// Create bottom View which covers from bottom of the screen to the
/// bottom edge of the bottomAccessoryView.
/// (useful on iPhone X only)
/// Make sure not to call more than once (typically, on viewDidLoad),
/// and bottomAccessoryView has added as subview.
///
/// - parameter bottomAccessoryView: a target View to decide the