Skip to content

Instantly share code, notes, and snippets.

View tanjo's full-sized avatar
🌐
https://twitter.com/tanjoin

Yuuki Tanjo tanjo

🌐
https://twitter.com/tanjoin
View GitHub Profile
@tanjo
tanjo / sample.js
Last active November 1, 2019 10:10
rgb(0, 1, 2) から HEX に変換するスクリプト
["rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)"]
.map((e) => "#" + e.style.borderTopColor
.replace(/rgb/g, '')
.replace(/\(/g,'')
.replace(/\)/g,'')
.replace(/ /g,'')
.split(',')
.map((e) => ("0" + parseInt(e).toString(16)).slice(-2))
.join(''))
.join(" ");
@tanjo
tanjo / UIStoryboard+Main.swift
Created February 7, 2020 09:17
Main.storyboard からインスタンス生成するための Extension
import UIKit
extension UIStoryboard {
static func mainInstantiate<T>(withViewController type: T.Type) -> T where T: UIViewController {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
guard let controller = storyboard.instantiateViewController(withIdentifier: type.storyboardIdentifier) as? T else {
fatalError("Could not instantiate view controller with type \(T.self)")
}
return controller