よく rvm や rbenv を使ってMacに複数バージョンのrubyをインストールする例を見るんですが、「それhomebrewでもできるよ」って思ったのでメモ。 とりあえず最新版を入れる場合 2012/7/27時点ではruby-1.9.3-p194がインストールされるみたいです。 $ brew insta... 続きを読む
2012-11-21 rbenv + ruby-build 環境で新し目のRubyを使いたい時 Ruby 1.9.3-p327 をインストールしたい 定義されていません $ CONFIGURE_OPTS="--with-readline-dir=/usr/local --with-openssl-dir=/usr/local" rbenv install 1.9.3-p327 ruby-build: definiti... 続きを読む
会員数3000万程度の規模のサービスを運営しているものです。 まずは http://newrelic.com の無料版を導入してみれば、ありとあらゆるボトルネックが見つかって改善できると思います。 また、ruby 1.9.2は起動がすごく遅いですしGCの性能にも偏りがあるので、こ... 続きを読む
Getting Started Migrating to Middleman 2.0 Templates, Layouts & Partials Sass and Compass CoffeeScript & Sprockets Dynamic Pages Pretty URLs Frontend Optimization Individual Page Configuration LiveReload Local YAML Data Custom Extensions Rack... 続きを読む
rbenvのrehashに関してツイートしたらchrubyを教えて貰った。 @gantawitter checkout chruby github.com/postmodern/chr… Does not require rehashing.— Postmodernさん (@ …rbenvのrehashに関してツイートしたらchrubyを教えて貰った。 @gantawitter checko... 続きを読む
人気の高いオープンソースのツール、RとRubyを使い、生データを処理し、シミュレーションし、仮説を立て、統計的手法を用いて検証する、というデータ解析の基本の理解を促します。基本が学べるだけでなく、自分のメールボックスや自分の心臓の鼓動など身近な題... 続きを読む
ruby, railsRuby 1.9系ではStringオブジェクトにエンコーディング情報が付加されていて、マルチバイトや複数エンコーディングを扱う日本人としては嬉しい限りだけど、時々エンコーディング関連で例外が発生して落ちすぎるぐらい落ちるように感じるときがある。... 続きを読む
http://rubygems.org/gems/cosmicrawlerソースは、https://github.com/bash0C7/cosmicrawlergem install cosmicrawlerするとか、Gemfileにgem 'cosmicrawler'と書いてbundle installするとかした後、 require 'cosmicrawler' Cosmicrawler.http_crawl(%w(http:/... 続きを読む
A presentation comparing the Python and Ruby programming languages. I gave this talk at LA RubyConf 2013. 続きを読む
「Rubyのcase」を一瞥し「あー要は〇〇(言語名)のswitchね」などと早合点し、その後もその真の価値を知ることなく一生を終えるプログラマが近年跡を絶たない。加えて、「今更条件分岐?RubyはOOPなんだからポリモフィズムじゃね?」とか「HashにProc突っ込んでc... 続きを読む
Octopress is an obsessively designed framework for Jekyll blogging. Itâs easy to configure and easy to deploy. Sweet huh? 続きを読む
In Ruby, Dir.glob("**/*.rb") (for instance) doesn't traverse symlinked directories. Is it possible to get the ** to traverse symlinks? I'm using two gems which find files this way, but I need them to see files within a symlinked directory. 続きを読む
Ruby, Perlrbenvを使ってみる - すぎゃーんメモの続き。現時点でのrbenvのバージョンは0.2.1。rbenvを使っていると.rbenv-versionファイルの有無でrubyコマンド打ったときに実行されるrubyが違うものになる、というのがちょっと新鮮で、これはどういう仕組みで... 続きを読む
Rubyはたのしい言語です。Rubyを触っているとマニュアルにも書いていない「小さな発見」に遭遇することがよくあります。このような「発見」は、プログラムの質や効率の改善には直結しないかもしれません。いや、むしろチームプログラミングでは妨げになる可能性... 続きを読む
Abstract ... nearly everybody is convinced that every style but their own is ugly and unreadable. Leave out the "but their own" and they're probably right... --Jerry Coffin (on indentation) This document was created when I, as the Technical L... 続きを読む
2011-10-25 Thorで簡単にコマンドラインアプリをつくる Thorをご存知の方は多いと思いますが、Retterを作るにあたってとても便利に使えたので、手短に紹介したいと思います。 といってもだいたいはWikiに書いてあることしか書けないんですが、何しろ英語ですし... 続きを読む
第一回 超絶技巧 Ruby 意味不明コンテスト in RubyKaigi TRICK の理念 現世利益のない、意味不明な Ruby プログラムを書く。 Ruby のある種の神秘性 (と仕様バグ) を明らかにする。 Ruby 処理系の意外な堅牢性と移植性を示す。 メンテナンス不能だが価値あるコ... 続きを読む
Can I define the offset of the index in the each_with_index loop iterator? My straight forward attempt failed: some_array.each_with_index{|item, index = 1| some_func(item, index) } Edit: Clarification: I don't want an array offset I want that... 続きを読む
Ruby 2.0 Enumerable::Lazy March 13, 2012 by Innokenty Mihailov | 17 Comments TL; DR Why? When? How? 4.1. Enumerator (skip if familiar with) 4.2. Lazy enumerator 4.3. C patch Conclusion TL; DR My Enumerable::Lazy patch was accepted into ruby t... 続きを読む
Hey I have an array where each element is a hash containing a few values and a count. result = [ {"count" => 3,"name" => "user1"}, {"count" => 10,"name" => "user2"}, {"count" => 10, "user3"}, {"count" => 2, "user4"} ] I can sort the array by ... 続きを読む