Skip to content

Instantly share code, notes, and snippets.

View urouro's full-sized avatar

Kenta Nakai urouro

View GitHub Profile
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 / .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

@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 / alt2ime.ahk
Created October 30, 2015 09:56
Windows 8 + Google IME + AutoHotKey / 左Altを押したときに英数入力、右Altを押したときに日本語入力できるようにする
;
; rf. http://qiita.com/844196/items/9fc1cd8470a9ad9c3a69#2-3
;
IME_ON(hWindow, IsON)
{
; WM_IME_CONTROL = 0x0283
; IMC_SETOPENSTATUS = 0x0006
bufCurrentDetectMode := A_DetectHiddenWindows
DetectHiddenWindows, On
buf := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint",hWindow), "UInt", 0x0283, "Int", 0x0006, "Int", IsON)
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for subview in view.subviews {
if subview.isKindOfClass(UITextField) {
subview.resignFirstResponder()
}
}
}