Skip to content

Instantly share code, notes, and snippets.

@kennyj
kennyj / rails_3_1_RC4_changes.md
Created May 6, 2011 17:34 — forked from ryanb/rails_3_1_rc4_changes.md
Rails 3.1 RC4の変更点(和訳)

Railties 3.1 RC4

  • 新しいrakeタスク assets:clean はプリコンパイルされたアセットを削除する。

  • --skip-gemfile--skip-bundleなしでの、アプリケーションとプラグインのソース生成は、bundle installを走らせる

  • jdbc*アダプターにとってのデータベースタスクを修正した

  • jdbcpostgresqlにとってのテンプレート生成

@kennyj
kennyj / server.coffee
Created May 10, 2011 16:19
node.js echo server (coffeescript)
net = require 'net'
sockets = []
server = net.createServer (socket) ->
sockets.push socket
socket.on 'data', (d) ->
s.write d for s in sockets
@kennyj
kennyj / gen.sh
Created July 29, 2011 15:58
backbone.jsが利用できる状態でrailsプロジェクト生成
#!/bin/sh
# railsプロジェクト作成して移動する
rails new "$1" -T -J
cd "$1"
# Gemfileに必要なgemを追記する
cat << HERE >> Gemfile
gem 'jquery-rails'
@kennyj
kennyj / gist:1149301
Created August 16, 2011 15:01
centos5.xでnginxをインストール。サービス起動 & ログローテーション付き
■事前準備
# useradd -s /bin/false -d /usr/nginx nginx
# yum -y install libevent-devel pcre-devel zlib-devel openssl-devel
■インストール
# export NGINX=nginx-1.0.5
# wget http://www.nginx.org/download/"$NGINX".tar.gz
# tar zxvf "$NGINX".tar.gz
# cd $NGINX
@kennyj
kennyj / gist:1162951
Created August 22, 2011 17:22
jrubyでirb GC説明付き
jruby -J-verbose:gc -S irb
@kennyj
kennyj / gen.sh
Created October 5, 2011 17:23
backbone.jsが利用できる状態でrailsプロジェクト生成(rails3.1版)
#!/bin/sh
# railsプロジェクト作成して移動する
rails new "$1" -T
cd "$1"
# Gemfileに必要なgemを追記する
cat << HERE >> Gemfile
gem 'rails-backbone'
@kennyj
kennyj / gist:1324683
Created October 29, 2011 15:55
行末の空白を削除
find * -type f -exec sed 's/[ \t]*$//' -i {} \;
from https://github.com/rails/rails/commit/b451de0d6de4df6bc66b274cec73b919f823d5ae#activesupport/lib/active_support/cache.rb
ruby-1.9.2-p180 :019 > a = "x = 'a.\\'b.c' and y = 'b.d.e'"
=> "x = 'a.\\'b.c' and y = 'b.d.e'"
ruby-1.9.2-p180 :020 > a.gsub(/'([^'\\]|\\\\|\\')*?'/, "")
=> "x = and y = "
find . -name "*.rb" -print | xargs grep " and " | grep -v "# " | grep -v "_test.rb:"
./actionpack/lib/action_view/helpers/form_helper.rb: if object ||= @template.instance_variable_get("@#{Regexp.last_match.pre_match}") and object.respond_to?(:to_param)
./actionpack/lib/action_view/helpers/number_helper.rb: if significant and precision > 0
./actionpack/lib/action_view/helpers/capture_helper.rb: if string = buffer.presence || value and string.is_a?(String)
./actionpack/lib/action_controller/caching/sweeping.rb: ActiveRecord::Base.observers << sweeper if defined?(ActiveRecord) and defined?(ActiveRecord::Base)
./actionpack/lib/action_controller/caching/sweeping.rb: if defined?(ActiveRecord) and defined?(ActiveRecord::Observer)
./actionpack/lib/action_controller/caching/actions.rb: path << ".#{extension}" if extension and !path.split('?').first.ends_with?(".#{extension}")
./actionpack/lib/action_controller/vendor/html-scanner/html/node.rb: (c.kind_of?(HTML::
@kennyj
kennyj / gist:1874619
Created February 21, 2012 07:16
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.1)
actionpack (= 3.2.1)
mail (~> 2.4.0)
actionpack (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
builder (~> 3.0.0)