Skip to content

Instantly share code, notes, and snippets.

View mono0926's full-sized avatar
🐶
( ´・‿・`)

mono — Masayuki Ono mono0926

🐶
( ´・‿・`)
View GitHub Profile
@mono0926
mono0926 / file0.swift
Last active August 29, 2015 14:15
Notificationの登録を簡単にするextension ref: http://qiita.com/mono0926/items/e3a76dc95046f0eeeb29
extension UIViewController {
// こんな感じの公開メソッドを増やしていく
func observeKeyboard(willShowSelector: Selector, willHideSelector: Selector) -> () -> () {
return observeNotification([
(action: willShowSelector, name: UIKeyboardWillShowNotification),
(action: willHideSelector, name: UIKeyboardWillHideNotification)])
}
func observeDidBecomeActive(action: Selector) -> () -> () {
return observeNotification(action, name: UIApplicationDidBecomeActiveNotification)
}
@mono0926
mono0926 / localized.codesnippet
Created June 28, 2015 23:26
NSLocalizedString snippet
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>localized</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>All</string>
</array>
goto loc_100000f00;
loc_100000f00:
COND = OVERFLOW(rax);
if (COND) goto loc_100000f1f;
loc_100000f09:
rbx = rbx + 0x1;
if (rbx != 0x65) goto loc_100000f00;
let params: [String: AnyObject!] = [
"avatarData": avatarData,
"displayName": member.displayName,
"currentCharacterId": member.currentCharacterId,
"profileView.birthday": member.birthday,
"sex": member.sex.rawValue,
"profileView.bloodType": member.bloodType.rawValue,
"address.country": member.address.country.rawValue, // "address: account.address!.dictはbindされないので。通常のrequestならOK"
"profileView.address.prefectures": member.address.prefectures.rawValue,
"profileView.hometown.country": member.hometown.country.rawValue,
@mono0926
mono0926 / commit_message_example.md
Last active May 29, 2024 14:43
[転載] gitにおけるコミットログ/メッセージ例文集100
@mono0926
mono0926 / karabiner.json
Last active May 19, 2023 04:41
Karabiner-Elementsの、日本語キーボードの設定ファイル例 ( `~/.config/karabiner/karabiner.json` に配置)
{
"global": {
"ask_for_confirmation_before_quitting": true,
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false,
"unsafe_ui": false
},
"profiles": [
{
@mono0926
mono0926 / #colorLiteral.swift
Created September 24, 2016 13:09
#colorLiteral
import UIKit
extension UIColor {
class var theme: UIColor { return #colorLiteral(red: 0.4274509804, green: 0.7568627451, blue: 0.6196078431, alpha: 1) }
class var notification: UIColor { return #colorLiteral(red: 1, green: 0.4666666667, blue: 0, alpha: 1) }
class var negative: UIColor { return #colorLiteral(red: 0.9843137255, green: 0.4588235294, blue: 0.4588235294, alpha: 1) }
class var darkBackground: UIColor { return #colorLiteral(red: 0.1725490196, green: 0.1725490196, blue: 0.1725490196, alpha: 1) }
class var darkLightBackground: UIColor { return #colorLiteral(red: 0.3401621282, green: 0.3401621282, blue: 0.3401621282, alpha: 1) }
}
import UIKit
extension UIColor {
class var theme: UIColor { return #colorLiteral(red: 0.4274509804, green: 0.7568627451, blue: 0.6196078431, alpha: 1) }
// 別解1(推奨)
struct MyApp {
static var theme: UIColor { return #colorLiteral(red: 0.4274509804, green: 0.7568627451, blue: 0.6196078431, alpha: 1) }
}
import UIKit
extension UIColor {
struct JoinUs {
private init() {}
/** #6DC19E */
static let theme = #colorLiteral(red: 0.4274509804, green: 0.7568627451, blue: 0.6196078431, alpha: 1)
/** #FF7700 */
static let notification = #colorLiteral(red: 1, green: 0.4666666667, blue: 0, alpha: 1)
/** #FB7575 */
let emojiLogFormatter = PrePostFixLogFormatter()
emojiLogFormatter.apply(prefix: "🗯🗯🗯 ", postfix: " 🗯🗯🗯", to: .verbose)
emojiLogFormatter.apply(prefix: "🔹🔹🔹 ", postfix: " 🔹🔹🔹", to: .debug)
emojiLogFormatter.apply(prefix: "ℹ️ℹ️ℹ️ ", postfix: " ℹ️ℹ️ℹ️", to: .info)
emojiLogFormatter.apply(prefix: "⚠️⚠️⚠️ ", postfix: " ⚠️⚠️⚠️", to: .warning)
emojiLogFormatter.apply(prefix: "‼️‼️‼️ ", postfix: " ‼️‼️‼️", to: .error)
emojiLogFormatter.apply(prefix: "💣💣💣 ", postfix: " 💣💣💣", to: .severe)
log.formatters = [emojiLogFormatter]