Skip to content

Instantly share code, notes, and snippets.

View imairi's full-sized avatar
🐢
Can make it!

Yosuke Imairi imairi

🐢
Can make it!
View GitHub Profile
@atomicbird
atomicbird / logMilestone.swift
Last active August 22, 2023 03:41
Sometimes you just want to print a message that tells you a line of code was executed. Inspired by a tweet from Paige Sun: https://twitter.com/_PaigeSun/status/1161132108875796480
/// Log the current filename and function, with an optional extra message. Call this with no arguments to simply print the current file and function. Log messages will include an Emoji selected from a list in the function, based on the hash of the filename, to make it easier to see which file a message comes from.
/// - Parameter message: Optional message to include
/// - file: Don't use; Swift will fill in the file name
/// - function: Don't use, Swift will fill in the function name
/// - line: Don't use, Swift will fill in the line number
func logMilestone(_ message: String? = nil, file: String = #file, function: String = #function, line: Int = #line) -> Void {
#if DEBUG
// Feel free to change the list of Emojis, but don't make it shorter, because a longer list is better.
let logEmojis = ["😀","😎","😱","😈","👺","👽","👾","🤖","🎃","👍","👁","🧠","🎒","🧤","🐶","🐱","🐭","🐹","🦊","🐻","🐨","🐵","🦄","🦋","🌈","🔥","💥","⭐️","🍉","🥝","🌽","🍔","🍿","🎹","🎁","❤️","🧡","💛","💚","💙","💜","🔔"]
let logEmoji = logEmojis[abs(
// Copyright © 2019 Ooma Inc. All rights reserved.
import Foundation
import RIBs
import RxSwift
// MARK: - Plugin
public protocol Plugin: AnyObject {
associatedtype Component = Dependency
名前 場所 温泉 作業場所 回線 備考
RAKU SPA 鶴見 x 温泉じゃない
テルマー湯 混雑すると回線がつながらないという報告あり
東京染井温泉 Sakura 回線が作業する場所まで有効なのか不明
おふろカフェ utatane めっちゃ混むしやや遠い
綱島源泉湯けむりの庄 お休みどころでWiFi接続できるらしい
極楽湯 京王高尾山温泉 KEIO FREE WIFIと貸座敷を組み合わせれば作業できそうな気がする
import UIKit
final class KeepingContentOffsetCollectionViewLayout : UICollectionViewFlowLayout {
private var oldOffset: CGFloat?
typealias Completion = () -> Void
/// Perform passed closure with keeping current contentOffset.
///
@kishikawakatsumi
kishikawakatsumi / OptionParser.swift
Created April 5, 2018 15:57
SwiftPM ArgumentParser usage
let parser = ArgumentParser(commandName: "swiftfmt", usage: "swiftfmt filename [options]", overview: "Format Swift source code")
let filenameArgument = parser.add(positional: "filename", kind: String.self)
let configrationOption = parser.add(option: "--configuration", kind: String.self)
let versionOption = parser.add(option: "--version", kind: Bool.self)
let verboseOption = parser.add(option: "--verbose", kind: Bool.self, usage: "Show more debugging information")
let result = try parser.parse(Array(CommandLine.arguments.dropFirst()))
if let version = result.get(versionOption) {
print("Swiftfmt 0.1.0")
@ayakix
ayakix / real_estate.md
Last active October 10, 2022 01:23
不動産・ローン調査

ローン

住宅ローン控除

  • 控除対象借入額の上限:4000万円
  • 控除率:1%
  • 控除期間:10%
  • 最大控除額:40万/年
  • 住民税からの控除上限額:13.65万/年
  • ペアローンor連帯債務なら夫婦ともに控除

ローンの組み方

@mono0926
mono0926 / Alert.swift
Last active September 20, 2018 14:21
Protocol OrientedなRxSwift化したUIAlertController
import Foundation
import RxSwift
private func getAllEnumValues<T: Hashable>(_: T.Type) -> [T] {
var i = 0
let iterator = AnyIterator<T> {
let next = withUnsafeBytes(of: &i) { $0.load(as: T.self) }
if next.hashValue != i { return nil }
i += 1
return next

マージ済みのリモートブランチを全て削除

git branch -r --merged master | grep -v -e master -e develop | sed -e 's% *origin/%%' | xargs -I% git push --delete origin %
  1. remote の master に merge済み の branch をすべて表示して
  2. master と develop は消えてほしくないので除外して
  3. origin/ を削除して
  4. xargs (-I% % で ブランチ名を渡しつつ、全て削除する)
@naokazuterada
naokazuterada / reset_rebase.sh
Last active May 15, 2024 05:40
git rebaseを間違えた時に元に戻す
git reflog
# これで、以下の様なのが参照できる
2be6f11 HEAD@{0}: xxxxxxxxxxxx
18389ad HEAD@{1}: xxxxxxxxxxxxx
0c485c8 HEAD@{2}: xxxxxxxxxxxxxx
b751438 HEAD@{3}: xxxxxxxxxxxxxxx # ここに戻したいので一つ前の数字を指定↓
hc8a0s8 HEAD@{4}: xxxxxx
# 「q」で戻って・・・
git reset --hard 'HEAD@{4}'
# のように数字を指定すると元に戻る!
@d3m3vilurr
d3m3vilurr / feedly_api.md
Last active March 30, 2024 08:21
Unofficial Feedly API Document

IDs

  • user_id - user/:uid
  • feed_id - feed/:feed_uri
  • category_id - :user_id/category/:category (special category: global.all, global.uncategorized)
  • tag_id - :user_id/tag/:tag (special tag: global.saved)

APIs

http://cloud.feedly.com/:version/:api