Skip to content

Instantly share code, notes, and snippets.

View katsuyoshi's full-sized avatar

Katsuyoshi Ito katsuyoshi

  • ITO SOFT DESIGN Inc.
  • Akita, Japan
View GitHub Profile
@katsuyoshi
katsuyoshi / gist:633820a3bb9705e1bb8d
Last active January 29, 2016 13:00
Apple Watchでroundの処理
p [BigDecimal::ROUND_HALF_UP, BigDecimal::ROUND_UP, BigDecimal::ROUND_DOWN]
v = BigDecimal.new("1")/BigDecimal.new("3")
p v.round(9, BigDecimal::ROUND_HALF_UP).to_s
p v.round(9, BigDecimal::ROUND_UP).to_s
p v.round(9, BigDecimal::ROUND_DOWN).to_s
# Apple Watch
[0, 2, 1]
"0.333333333"
"0.333333334"
foo = Foo.create(name: "name1")
foo.updated_at = Time.now # OK
# foo.setPrimitiveValue Time.now, forKey:"updated_at" # NG
foo.setPrimitiveValue "name a", forKey:"name" # OK
cdq.save #<= Crash iOS7
Thread 7 name: Dispatch queue: com.apple.root.default-qos
Thread 7 Crashed:
0 mimamori 0x00488998 void std::__1::__tree_balance_after_insert<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*, std::__1::__tree_node_base<void*>*) + 124
1 mimamori 0x00475c32 RoxorCore::method_node_get(objc_method*, bool) + 218
2 mimamori 0x0047ac32 RoxorCore::copy_method(objc_class*, objc_method*, objc_class*) + 398
3 mimamori 0x0047aa20 rb_vm_copy_methods + 56
4 mimamori 0x0039c63a rb_include_module2 + 438
5 mimamori 0x0039c6f8 rb_include_module + 16
6 mimamori 0x003c15da rb_extend_object + 218
luke:MyHostApp ISD$ rake clean:all
Delete ./build
Delete MyWatchApp/build
Delete /Users/ISD/Library/RubyMotion/build
luke:MyHostApp ISD$ rake watch
Build ./build/iPhoneSimulator-8.2-Development
Build MyWatchApp/build/iPhoneSimulator-8.2-Development
Compile ../../.rvm/gems/ruby-2.0.0-p353/gems/ib-0.7.1/lib/ib/outlets.rb
Compile MyWatchApp/app/glance_controller.rb
Compile MyWatchApp/app/interface_controller.rb
@katsuyoshi
katsuyoshi / gist:a386f9bc9726ca0c2d90
Created December 17, 2014 11:18
RubyMotion アップデート時のエラー
$ sudo motion update
Password:
Connecting to the server...
Downloading software update...
######################################################################## 100.0%
Installing software update...
An error occurred while installing the software update: installer: Package name is RubyMotion
installer: Upgrading at base path /
installer: The upgrade failed (エラーによってインストールできませんでした。ソフトウェアの製造元に問い合わせてください。)
@katsuyoshi
katsuyoshi / output_of_gen_page.rb.csv
Created April 13, 2014 04:19
gen_page.rbの出力結果
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 1 column, instead of 8 in line 4.
page
page_no
3
page::items
class,x,y,width,height,style,device_name,title
Button,0,0,256,153,Square,M0,ランプ1
Button,0,153,256,153,Square,M1,ランプ2
Button,0,306,256,153,Square,M2,ランプ3
Button,0,459,256,153,Square,M3,ランプ4
@katsuyoshi
katsuyoshi / 三菱電機サンプル.csv
Created April 13, 2014 03:45
irBoardの三菱電機サンプルプロジェトをCSVファイルとして書き出したファイル
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 4 in line 1.
project
name,launch_page_no,style,transition
三菱電機サンプル,0,irPanel,push
page
page_no,class,title,background_color_name,locked,right_page_no
0,Page,,,0,1
page::items
class,x,y,width,height,style,title,alternate_title,line_width,corner_radius,padding,shape,lamp_negative,interlock_negative,switch_device_name,switch_mode,switch_negative,title_for_button,device_name,alternate_text_color_name,lamp_color_name,page_no
# -*- coding: utf-8 -*-
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
controller = MainViewController.alloc.init
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(controller)
@window.makeKeyAndVisible
true
end
end
@katsuyoshi
katsuyoshi / Issue of KVC
Last active December 20, 2015 06:59
KVCで値をセットする時にRubyのsetterを使ってるとRubyのsetterの方が呼び出されない問題
# -*- coding: utf-8 -*-
#
# KVCの問題:
# Rubyのsetterを定義した場合にKVCでRubyのsetterが呼び出されない。
#
# 結果:
# WARN: bazはnilにしないでください。
#
# 問題:
# WARN: quuzはnilにしないでください。
@katsuyoshi
katsuyoshi / gist:6018022
Created July 17, 2013 06:06
connect to sqlserver by rails
# 参照:
# http://ameblo.jp/murajun1/entry-11266484358.html
$ brew install freetds
$ gem install tiny_tds
$ gem install activerecord-sqlserver-adapter
$ rails new sqlserver-test
$ cd sqlserver-test
# Windows設定