- グローバル検索をOFF
- グローバル検索用のインデックスを消す
- 設定 -> 高度な設定 -> グローバル検索と索引データベースを有効にする のチェックをはずす
function to_ruby_hash($array){ | |
$result = "{"; | |
foreach($array as $key => $value){ | |
$result .= "\"".$key."\" => "; | |
if(is_array($value)){ | |
$result .= to_ruby_hash($value).",\n"; | |
}else{ | |
$result .= "\"".$value."\","; | |
} | |
} |
(defun search-region-by-google () | |
"search by google" | |
(interactive) | |
(shell-command-on-region (region-beginning) (region-end) "read WORD ; firefox \"http://www.google.com/search?q=$WORD\"")) | |
; C-c sに割り当て | |
(global-set-key "\C-cs" 'search-region-by-google) |
#!/usr/bin/env ruby | |
require 'webrick' | |
require 'webrick/httpproxy' | |
require 'uri' | |
# プロキシサーバオブジェクトを作る | |
s = WEBrick::HTTPProxyServer.new( | |
# バインドアドレス(デフォルト:nil) |
class Dice | |
attr_accessor :coords | |
def initialize | |
@coords = [[0,0,1],[1,0,0],[0,-1,0],[0,1,0],[-1,0,0],[0,0,-1]] | |
end | |
def top | |
@coords.each_with_index{|coord,i| | |
if coord == [0,0,1] | |
return i+1 |
# tramp+zshではうまく動かないときの設定 | |
case "$TERM" in | |
dumb | emacs) | |
PROMPT="%m:%~> " | |
unsetopt zle | |
;; | |
esac |
-- safeモードでmysql起動してから /usr/bin/mysqld_safe --user=root --skip-grant-tables | |
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; | |
FLUSH PRIVILEGES; |
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :set_locale | |
protected | |
def set_locale | |
logger.debug "* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}" | |
I18n.locale = params[:locale] || | |
extract_locale_from_accept_language_header || |
find /etc -type f -newer /root/install.log | xargs ls -alrt |
Spork.prefork do | |
... | |
RSpec.configure do |config| | |
.... | |
# for database_clener | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation,{:except => %w{except_tables}}) | |
DatabaseCleaner.strategy = :transaction | |
end |