Skip to content

Instantly share code, notes, and snippets.

View morizotter's full-sized avatar
😄
Good

Morita Naoki morizotter

😄
Good
View GitHub Profile
@morizotter
morizotter / file0.txt
Last active August 29, 2015 14:21
1行で画面タッチを可視化できるTouchVisualizerの使い方 ref: http://qiita.com/morizotter/items/616c8c4bc8bc0371ee95
TouchVisualizer.start()
@morizotter
morizotter / file0.txt
Created May 10, 2015 14:22
Xcode 6.3.1でCarthageを利用する際にSimVerifier returned error: Simulator verification failed.エラー ref: http://qiita.com/morizotter/items/552c2ef7e1652ad6fac6
$ carthage build --no-skip-current
*** xcodebuild output can be found in /var/folders/j9/s8z2l0l93jb3xz9y4_jx934h0000gn/T/carthage-xcodebuild.z1A534.log
*** Building scheme "CarthageSample" in CarthageSample.xcworkspace
A shell task failed with exit code 65:
2015-05-10 21:24:02.422 xcodebuild[72041:3409756] [MT] iPhoneSimulator: SimVerifier returned: Error Domain=NSPOSIXErrorDomain Code=53 "Simulator verification failed." UserInfo=0x7f8c15a7af50 {NSLocalizedFailureReason=A connection to the simulator verification service could not be established., NSLocalizedRecoverySuggestion=Ensure that Xcode.app is installed on a volume with ownership enabled., NSLocalizedDescription=Simulator verification failed.}
** BUILD FAILED **
The following build commands failed:
CompileSwift normal arm64 /Users/***/Desktop/CarthageSample/CarthageSample/Sample.swift
@morizotter
morizotter / file0.txt
Last active August 29, 2015 14:17
typeaheadのprefetchが動いていないように見える件 ref: http://qiita.com/morizotter/items/bffd0e256cd4e21e9324
var engine = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: "stations.json",
cacheKey: "change here!"
}
});
import UIKit
class HollowView: UIView {
var hollowRadius = 60.0 as CGFloat
lazy var hollowPoint: CGPoint = {
return CGPoint(
x: CGRectGetWidth(self.bounds) / 2.0,
y: CGRectGetHeight(self.bounds) / 2.0
)
func swizzle() {
var dict = ["This is Key.": "This is value."] as NSDictionary
var method: Method = class_getInstanceMethod(object_getClass(dict), "description")
var swizzledMethod: Method = class_getInstanceMethod(object_getClass(dict), "myDescription")
method_exchangeImplementations(method, swizzledMethod)
println(dict.description)
}
@morizotter
morizotter / bash
Last active August 29, 2015 14:13
Raspberry Pi開封から無線LAN経由でSSH接続して初期設定するまでのマイ・ウェイ(モニタ・キーボード無し) ref: http://qiita.com/morizotter/items/48ad0b17207b0dd66cac
$ diskutil list
@morizotter
morizotter / file0.txt
Last active August 29, 2015 14:11
XcodeのLive Renderingを使って簡単に使い勝手の良いアイコンボタンをつくろう ref: http://qiita.com/morizotter/items/3483108f8e3266ef4c81
@IBDesignable
class IconButton: UIControl {
@IBInspectable var iconImage: UIImage?
override func drawRect(rect: CGRect) {
if let iconImage = self.iconImage {
iconImage.drawInRect(self.bounds)
@morizotter
morizotter / file0.txt
Created December 9, 2014 13:45
XcodeのLive Renderingを使って簡単に使い勝手の良いアイコンボタンをつくろう ref: http://qiita.com/morizotter/items/2347363f99bd48f925da
@IBDesignable
class IconButton: UIControl {
@IBInspectable var iconImage: UIImage?
override func drawRect(rect: CGRect) {
if let iconImage = self.iconImage {
iconImage.drawInRect(self.bounds)
// とりあえず、fontと表示したいテキストを用意
let font = UIFont.systemFontOfSize(20.0)
let text = "T"
// 上記で用意したfontを利用した場合のテキストのサイズを取得
var attributes = [NSObject: AnyObject]()
attributes[NSFontAttributeName] = font
let size = text.sizeWithAttributes(attributes)
// テキストのサイズから表示するframeを作成
@morizotter
morizotter / file0.swift
Last active August 29, 2015 14:08
AutoLayoutをSwiftで簡潔に記述できるSnappyを試してみた ref: http://qiita.com/morizotter/items/0856e5614486df65eee6
import UIKit
import Snappy
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// FULL SCREEN VIEW [BLUE]