Skip to content

Instantly share code, notes, and snippets.

Kosuke Ohmura KosukeOhmura

Block or report user

Report or block KosukeOhmura

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@KosukeOhmura
KosukeOhmura / flexscoreboard_privacy_policy.md
Last active Feb 9, 2019
flexscoreboard_privacy_policy.md
View flexscoreboard_privacy_policy.md

Privacy Policy

Effective date: February 1, 2019

Your privacy is important to us. It is Kosuke Ohmura's policy to respect your privacy regarding any information we may collect from you across our website, https://www.kosukeohmura.com, and other sites we own and operate.

  • What data we store, we’ll protect within commercially acceptable means to prevent loss and theft, as well as unauthorised access, disclosure, copying, use or modification. We don’t share any personally identifying information publicly or with third-parties, except when required to by law.
  • We may use third-party Service Providers to monitor and analyze the use of our Service.
  • Our application may link to external sites that are not operated by us. Please be aware that we have no control over the content and practices of these sites, and cannot accept responsibility or liability for their respective privacy policies.
  • Your continued use of our application will be regarded as acceptance of our practices around privacy and personal infor
@KosukeOhmura
KosukeOhmura / file1.txt
Last active May 2, 2019
Rails アプリを eager_load! してみることでプロダクション環境での出落ちを未然に防ぐ ref: https://qiita.com/KosukeOhmura/items/3a7b7d9deb74bdb103b5
View file1.txt
bundle exec rails runner Rails.application.eager_load!
@KosukeOhmura
KosukeOhmura / AppDelegate.swift
Last active Dec 1, 2018
UIWindow を使用して安全にグローバルなモーダル画面を表示する ref: https://qiita.com/KosukeOhmura/items/a3dd4f4678291ddb8a6a
View AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow()
self.window = window // 参照を保持しておく
window.makeKeyAndVisible()
return true
}
@KosukeOhmura
KosukeOhmura / ListViewController.swift
Created Dec 14, 2017
【UITableView】ページング処理のため残りの cell の数を取得する ref: https://qiita.com/KosukeOhmura/items/09f6836a5d2b56467dd8
View ListViewController.swift
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if tableView.belowCellsCount(cellIndexPath: indexPath) < 6 {
// 残りのセル数が6を下回った
// 追加のコンテンツ取得処理
self.viewModel.fetchList()
}
}
@KosukeOhmura
KosukeOhmura / URL+.swift
Last active Sep 29, 2017
Swift で URL のクエリストリングを簡単に追加したい ref: http://qiita.com/KosukeOhmura/items/8b65bdb63da6df95c7a3
View URL+.swift
extension URL {
// クエリを一つ追加した新しいURLを返す
func queryItemAdded(name: String, value: String?) -> URL? {
return self.queryItemsAdded([URLQueryItem(name: name, value: value)])
}
// クエリを複数追加した新しいURLを返す
func queryItemsAdded(_ queryItems: [URLQueryItem]) -> URL? {
guard var components = URLComponents(url: self, resolvingAgainstBaseURL: nil != self.baseURL) else {
@KosukeOhmura
KosukeOhmura / ImageManager.swift
Last active Jan 12, 2019
iOS で RxSwift を使ってカメラかフォトライブラリから画像を一枚取得する ref: http://qiita.com/KosukeOhmura/items/b5986bfe9a8b6778ffc8
View ImageManager.swift
final class ImageManager {
// 権限確認 -> 選択された画像のストリーム
func pick(on viewController: UIViewController, sourceType: UIImagePickerControllerSourceType) -> Observable<Result<UIImage, InternalError>> {
return self.authorizedSourceType(sourceType)
// 画像選択画面作成
.map { sourceType -> (picker: UIImagePickerController, delegate: ImagePickerControllerDelegate) in
// UIImagePickerControllerとそれにわたすdelegateを生成
let picker = UIImagePickerController()
let delegate = ImagePickerControllerDelegate()
@KosukeOhmura
KosukeOhmura / WebViewController.swift
Created Jul 29, 2017
モーダルで表示したUIWebView上のアラートが閉じたときにUIWebViewも道連れにされた話 ref: http://qiita.com/KosukeOhmura/items/4c8bc66947f1d3209597
View WebViewController.swift
final class WebViewController: UIViewController {
// 閉じるボタンが押されたフラグ
private var closeBtnFlag: Bool = false
@IBOutlet private weak var webView: UIWebView!
/*
中略
*/
View BadKbn.swift
class Constants {
enum Kbn: String {
// 性別
case genderKbnMan = "00101"
case genderKbnWoman = "00102"
// 都道府県
case prefectureKbnHokkaido = "00201"
// ...
var logicalName: String {
@KosukeOhmura
KosukeOhmura / file0.txt
Created Jan 25, 2017
プロジェクトを開いたり、アプリをrunすると "Xcodeが予期しない理由で終了しました。" となる ref: http://qiita.com/KosukeOhmura/items/bb6986d723a36633411b
View file0.txt
rm -r ~/Library/Developer/Xcode/DerivedData/
You can’t perform that action at this time.