Skip to content

Instantly share code, notes, and snippets.

View satococoa's full-sized avatar

Satoshi Ebisawa satococoa

View GitHub Profile
module Kernel
def p(arg)
BubbleWrap.p(arg) if RUBYMOTION_ENV != 'release'
end
end
@satococoa
satococoa / ApplySyntax.sublime-settings
Last active January 18, 2016 21:21
Sublime Text 3 RubyMotionBuilder and ApplySyntax settings
// Packages/User/ApplySyntax.sublime-settings
{
// If you want exceptions reraised so you can see them in the console, change this to true.
"reraise_exceptions": false,
// If you want to have a syntax applied when new files are created, set new_file_syntax to the name of the syntax to use.
// The format is exactly the same as "name" in the rules below. For example, if you want to have a new file use
// JavaScript syntax, set new_file_syntax to 'JavaScript'.
"new_file_syntax": false,
base_dir = "/var/www/hoge_server"
worker_processes 20
working_directory "#{base_dir}/current"
shared = "#{base_dir}/shared"
listen "#{shared}/tmp/sockets/unicorn.sock"
timeout 30
pid "#{shared}/tmp/pids/unicorn.pid"
stderr_path "#{shared}/log/unicorn.stderr.log"
stdout_path "#{shared}/log/unicorn.stdout.log"
@satococoa
satococoa / copy_sdk.sh
Created November 26, 2013 05:06
Mavericks で iOS 6 SDK でビルドしたかった http://hipbyte.myjetbrains.com/youtrack/issue/RM-188
#!/bin/sh
# copy sdk
XCODE4=/Applications/Xcode4.app/Contents/Developer
XCODE5=/Applications/Xcode.app/Contents/Developer
SIM_DIR=Platforms/iPhoneSimulator.platform/Developer/SDKs
IOS_DIR=Platforms/iPhoneOS.platform/Developer/SDKs
rsync -av ${XCODE4}/${SIM_DIR}/iPhoneSimulator6.1.sdk ${XCODE5}/${SIM_DIR}
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "centos6.4"
@satococoa
satococoa / main_spec.rb
Last active March 12, 2017 23:46
spec が強制終了してる?
class User
attr_accessor :name
def initialize(name = '')
@name = name
end
def initWithCoder(decoder)
self.init
self.name = decoder.decodeObjectForKey('name')
@satococoa
satococoa / setup.sh
Last active June 5, 2016 03:02
Mac OS X 上での Homebrew + rbenv + ruby-build + ruby + rails の環境構築(Xcode, Comamnd Line Tools のインストールを済ませてから。)
# Homebrew のインストール
# 公式 (http://brew.sh/) に載っているコマンドです
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Ruby のビルドに必要なものをインストール
brew install openssl readline rbenv ruby-build # 時間がかかります
# rbenv 用の設定を .bash_profile に書き込む
echo 'export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl) --with-readline-dir=$(brew --prefix readline) $RUBY_CONFIGURE_OPTS"' >> ~/.bash_profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
@satococoa
satococoa / user.rb
Last active December 18, 2015 14:19
User モデル
class User < ActiveRecord::Base
has_secure_password
validates :email, presence: true, uniqueness: true
validates :password, length: { minimum: 6, if: ->(u) { u.password.present? } }
end
@satococoa
satococoa / array_spec.rb
Created June 16, 2013 10:44
標準添付の minitest だけでもこのくらい書ける
require 'minitest/autorun'
describe Array do
before do
@array = Array.new
end
describe '#push' do
it '要素が追加されること' do
@array.push 'foo'
@satococoa
satococoa / ApplySyntax.sublime-settings
Last active December 18, 2015 03:39
SublimeText 2 の ApplySyntax プラグイン用 RubyMotion 設定。
{
// If you want exceptions reraised so you can see them in the console, change this to true.
"reraise_exceptions": false,
// If you want to have a syntax applied when new files are created, set new_file_syntax to the name of the syntax to use.
// The format is exactly the same as "name" in the rules below. For example, if you want to have a new file use
// JavaScript syntax, set new_file_syntax to 'JavaScript'.
"new_file_syntax": false,
// Put your custom syntax rules here: