Skip to content

Instantly share code, notes, and snippets.

View tosik's full-sized avatar
🏠
Working from home

Toshiyuki Hirooka tosik

🏠
Working from home
  • Tokyo, Japan
View GitHub Profile
trying gist command. its ok?
@tosik
tosik / gist:3676732
Created September 8, 2012 16:24
Creates Motion::Project::Config#dependencies(from: path, to: path)
class Motion::Project::Config
def dependencies(args)
from, to = args[:from], args[:to]
Dir[from].each do |from_file|
Dir[to].each do |to_file|
files_dependencies from_file => to_file
end
end
end
end
def shouldAutorotateToInterfaceOrientation(orientation)
autorotateToOrientation(orientation)
end
function title {
#screen -X eval "title '$1'"
tmux rename-window $1
}
@tosik
tosik / gist:3831768
Created October 4, 2012 06:23
to tmpfs
sudo mkdir -p /tmpfs/mysql
sudo ./mount-ram /tmpfs/mysql 500
sudo chown `whoami`:admin /tmpfs/mysql
mysql.server stop
cp -rfp /usr/local/var/mysql/* /tmpfs/mysql/
mv /usr/local/var/mysql /usr/local/var/mysql.orig
ln -s /tmpfs/mysql /usr/local/var/mysql
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
% rake simulator --verbose
DYLD_FRAMEWORK_PATH="/Applications/Xcode.app/Contents/Developer/../Frameworks":"/Applications/Xcode.app/Contents/Developer/../OtherFrameworks" /Library/RubyMotion/bin/sim 2 1 6.0 "/Applications/Xcode.app/Contents/Developer" "./build/iPhoneSimulator-6.0-Development/hello.app"

RubyMotion で Marshal.load(Marshal.dump(obj)) しても obj の深いクローンが再現されないケースがある。

RubyMotion と ruby1.9 で bug.rb を実行すると二つの環境で挙動に違いがある。 RubyMotion 上では Hash を継承したクラスの property が Marshal.dump されないみたいだ。

/Users/hirooka/prog% motion create hello
Create hello
Create hello/.gitignore
Create hello/Rakefile
Create hello/app
Create hello/app/app_delegate.rb
Create hello/resources
Create hello/spec
Create hello/spec/main_spec.rb
class Command < Core::MotionHash
property :uri
property :method
property :data
def run
model.find(id).send(method, data)
end