Skip to content

Instantly share code, notes, and snippets.

View urouro's full-sized avatar

Kenta Nakai urouro

View GitHub Profile
@urouro
urouro / .md
Created February 9, 2016 10:16
rbenv install 2.2.4, but failed with`The Ruby readline extension was not compiled.` / Mac OS X El Capitan, rbenv 1.0.0, ruby-build 20160111
% ruby-build --version
ruby-build 20160111
% rbenv --version
rbenv 1.0.0

Failed

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for subview in view.subviews {
if subview.isKindOfClass(UITextField) {
subview.resignFirstResponder()
}
}
}
ruby -rsecurerandom -e "puts SecureRandom.uuid"
@urouro
urouro / .swift
Created March 7, 2016 06:01
Coutable enum
private enum Example: Int {
case FirstItem
case SecondItem
case ThirdItem
static var count: Int {
var i = 1
while Example(rawValue: i) != nil {
i = i + 1
}
@urouro
urouro / .swift
Created February 14, 2016 11:28
Swift singleton
class <# ClassName #> {
static let sharedInstance = <# ClassName #>()
private init() {}
}
@urouro
urouro / gist:11fe27c49f57fb949115
Created January 14, 2016 04:53
Print class name, method name, and line number on Xcode debugger Log Message
@[self class]@ [%B/%H]
@urouro
urouro / 1.plist
Created January 7, 2016 04:45
App Transport Security Setting
<!-- Disables ATS for any domains -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
@urouro
urouro / Const.swift
Last active January 5, 2016 05:41
Env.plist
import Foundation
class Const {
class var FeedbackSlackURL: String {
let url = env["FeedbackSlackURL"] as! String
return url
}
private class var env: NSDictionary {
@urouro
urouro / keymap.cson
Last active January 4, 2016 13:38
Atom Settings
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
@urouro
urouro / file0.txt
Created January 9, 2014 06:31
FMDatabase Code=7 "out of memory" ref: http://qiita.com/uro_uro_/items/3143651a815397e6adc5
NSString *sql = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS %@ ( \
item_id INTEGER PRIMARY KEY AUTOINCREMENT, \
title TEXT, \
on INTEGER, \
sort INTEGER, \
date DATETIME \
);", TABLE_NAME];